0

当我尝试加载 AdMob 广告时,我的应用 iPad 应用崩溃了,这是我的代码:

//Google AdMob
bannerView_ = [[GADBannerView alloc] initWithFrame:CGRectMake(0.0,
                                                              self.view.frame.size.height -
                                                              GAD_SIZE_728x90.height -40,
                                                              GAD_SIZE_728x90.width,
                                                              GAD_SIZE_728x90.height)];

// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = @"XXXXXXXXXXXXXX";

// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];

// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:[GADRequest request]];

[bannerView_ release];

日志是:

2013-07-27 13:44:37.145 XXXX[4057:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GADObjectPrivate changeState:]: unrecognized selector sent to instance 0x1e011f30'
*** First throw call stack:
(0x312122a3 0x390bd97f 0x31215e07 0x31214531 0x3116bf68 0x10d624 0x10f700 0x10caa0 0xea9b7 0x33039595 0x330c5353 0x33106d11 0x33105fe7 0x332283ef 0x331050c5 0x33105077 0x33105055 0x3310490b 0x33104e01 0x3302d5f1 0x3301a801 0x3301a11b 0x34d255a3 0x311e7683 0x311e6ee9 0x311e5cb7 0x31158ebd 0x31158d49 0x34d242eb 0x3306e301 0xbe065 0x394f4b20)
libc++abi.dylib: terminate called throwing an exception
(lldb) 

这里有什么问题?

4

1 回答 1

1

您缺少-ObjC每个文档

您现在需要添加-ObjC到应用程序目标的构建设置的其他链接器标志:

  1. 在 Xcode 的项目导航器中,按下蓝色的顶级项目图标。
  2. 单击您的目标,然后单击“构建设置”选项卡。
  3. Other Linker Flags下,添加-ObjCDebugRelease
于 2013-07-27T10:52:52.483 回答