IOS項目中加入Google Admob SDK


錯誤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。

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM