错误1. Undefined symbols for architecture i386:
"_OBJC_CLASS_$_ASIdentifierManager", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADIdentifierUtilities.o)
"_OBJC_CLASS_$_SKStoreProductViewController", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADOpener.o)
"_SKStoreProductParameterITunesItemIdentifier", referenced from:
-[GADOpener openInAppStore:fallbackURLString:] in libGoogleAdMobAds.a(GADOpener.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
除了《Google AdMob 广告 iOS 初级指南》(https://developers.google.com/mobile-ads-sdk/docs/ios/fundamentals?hl=zh-cn,此文篇后的最佳实践值得一看 )中所列出的几个lib需加入外,还需要加入AdSupport、StoreKit两个库
错误2. [GADObjectPrivate changeState:]: unrecognized selector sent to instance 0x95c17d0'
需要在build settings里的other linker flags添加-ObjC标志
错误3. 无法正确显示广告,log打出“Cannot determine request type. Is your ad unit id correct?”
需改代码:
self.adBanner.adUnitID = kSampleAdUnitID;
变量kSampleAdUnitID的定义指需改为你的Admob发布者ID。