AdMob crashes with [GADObjectPrivate changeState:]: unrecognized selector

后端 未结 4 1535
不知归路
不知归路 2020-12-02 18:26

I have installed the AdMob SDK 6.2.0 (Xcode 4.5 (4G182) and I am testing on an iPhone 4S and the simulator). I followed the tutorial and just want to get AdMob showing a ban

相关标签:
4条回答
  • 2020-12-02 18:40

    If you guys are still having trouble, make sure it's -ObjC and not -Objc. Geez, spent weeks trying to figure out why.

    0 讨论(0)
  • 2020-12-02 18:53

    You need to add -ObjC to the Other Linker Flags of your application target's build setting:

    1. Click the blue top-level project icon in XCode
    2. Choose your target and go to Build Settings
    3. Under Other Linker Flags add -ObjC for both Release and Debug

    Source: https://developers.google.com/mobile-ads-sdk/docs/admob/mediation#ios-linker

    Also be sure to do a clean and rebuild

    0 讨论(0)
  • 2020-12-02 18:56

    For those of you who tried adding the Obj-c linker flag and still got the same "unrecognized selector sent to instance" error when trying to load an ad I found a fix. This is for the newest XCode (version 8.1).

    For reference:

    • I added Google AdMob using cocoapods.
    • I used storyboard to make an outlet connection to my viewcontroller and GADBannerView was NOT available as a class so I wrote it in like most people did.
    • On one of the stackoverflow answers that I saw the custom class for the bannerview was set to GADBannerView, which I assume would happen automatically if it was an option in the dropdown list when you added the outlet. For me it wasn't since I had to type it in myself.

    Looking at the dropdown I saw that GADBannerView was available as an option and selected it.

    After selecting it, the app ran without a hitch, no need to add the linker flag (mine was blank by default) or anything.

    Hope this helps someone else!

    0 讨论(0)
  • 2020-12-02 19:00

    Best solution for me is use -force_load flag instead -ObjC enter image description here

    0 讨论(0)
提交回复
热议问题