依照官方教程添加文件及其 frameWork后 發現運行報錯 錯誤如下
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_ASIdentifierManager", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADIdentifierUtilities.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SKStoreProductViewController", referenced from:
objc-class-ref in RevMobAds(RevMobStoreController.o)
"_SKStoreProductParameterITunesItemIdentifier", referenced from:
-[RevMobStoreController openStoreWithITunesItemId:] in RevMobAds(RevMobStoreController.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
最終通過添加 frameWork搞定 添加了 StoreKit.framework AdSupport.framework CoreData.framework .
運行繼續報錯
ld: duplicate symbol _OBJC_CLASS_$_AppDelegate in /Users/AbhilashReddy/Library/Developer/Xcode/DerivedData/santabantaa-bykvybsbvqshqshfqxdlsxiqhehc/Build/Intermediates/santabantaa.build/Debug-iphonesimulator/santabantaa.build/Objects-normal/i386/AppDelegate-C7A14BE43C5E8C81.o and /Users/AbhilashReddy/Library/Developer/Xcode/DerivedData/santabantaa-bykvybsbvqshqshfqxdlsxiqhehc/Build/Intermediates/santabantaa.build/Debug-iphonesimulator/santabantaa.build/Objects-normal/i386/AppDelegate-A37C3709371E4892.o for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
原來很是2的把demo也給弄進來了,刪除demo的那個文件夾Add-ons 就好了
再次報錯 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GADObjectPrivate changeState:]: unrecognized selector sent to instance 0x95c17d0'
解決方案 add -ObjC to the Other Linker Flags of your application target's build setting。
加了個廣告 他妹的把所有能碰到的問題都碰到了 真是技術不純熟害死人啊。~~~
PS:要弄個全屏的Admob 看了下SDK 似乎沒有 就自己動手寫
[[GADBannerView alloc] initWithFrame:self.view.bounds]; 結果報錯 errors = "Ad size will not fit on screen"
但是改為 [[GADBannerView alloc] initWithFrame:CGRectMake(0,0,320,480)]; 就可以。 但是同時寫了下半屏的CGRect,發現半屏的 frame 顯示的不完全,左右被壓縮得很厲害,造成了只顯示了一個icon和一個按鈕。不知道怎么解決。