我已将iAd集成到我的应用程序中,并且正在模拟器中执行它。我保留了目标iOS 4.1。但是有时我会收到错误消息:
"Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString bannerViewDidLoadAd:]: unrecognized selector sent to instance 0x6451cd0' " and the application will be quit. What i have to do.
我在接口生成器中静态添加了
ADBannerView
,并使用了如下的委托方法:#pragma mark ADBannerViewDelegate
- (void)bannerViewDidLoadAd:(ADBannerView *)banner {
Class classAdBannerView = NSClassFromString(@"ADBannerView");
if(classAdBannerView!= nil)
iAdView2.hidden = NO;
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
Class classAdBannerView = NSClassFromString(@"ADBannerView");
if(classAdBannerView!= nil)
iAdView2.hidden = YES;
}
如果有人知道解决方案,请帮助我。
最佳答案
例外:
NSInvalidArgumentException', reason:
'-[NSCFString bannerViewDidLoadAd:]: unrecognized selector sent to instance 0x6451cd0' "
建议您的委托对象超出范围。可能是因为您已经在自动释放池中创建了它,或者在某个地方释放了它。您将需要保留它。
谢谢