AdMob crashes with [GADObjectPrivate changeState:]: unrecognized selector

后端 未结 4 1534
不知归路
不知归路 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: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!

提交回复
热议问题