我尝试加载AdMob广告时,iPad崩溃了

时间:2013-07-27 10:39:34

标签: ios objective-c ipad admob

当我尝试加载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) 

这里有什么问题?

1 个答案:

答案 0 :(得分:1)

您错过了-ObjCdocs

  

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

     
      
  1. 在Xcode的项目导航器中,按蓝色顶级项目图标。
  2.   
  3. 点击您的目标,然后点击构建设置标签。
  4.   
  5. 其他链接器下   标志,将-ObjC添加到调试发布
  6.