我在我的应用中使用Admob。
我收到以下错误: [GADDelegateManager didYouNilOutYourDelegate:selector:] at GADDelegateManager.m:48
我在dealloc中发布了我的Admob Banner对象。
任何人都可以告诉可能解决此错误的方法。
-(void)displayAds {
self.aBannerView.adUnitID = AdmobPublisherID;
[self.aBannerView setDelegate:self];
[self.aBannerView setRootViewController:roorViewController];
if (isAdLoaded) {
[self.view addSubview:self.aBannerView];
} else {
// Initiate a generic request to load it with an ad.
[self.view addSubview:self.aBannerView];
[self.aBannerView loadRequest:[self createRequest]];
isAdLoaded = YES;
}
}
#pragma mark GADRequest generation
- (GADRequest *)createRequest {
GADRequest *request = [GADRequest request];
request.testDevices = [NSArray arrayWithObjects: nil];
return request;
}
- (void)adViewDidReceiveAd:(GADBannerView *)adView {
NSLog(@"Received ad successfully popup");
if(self.aBannerView !=nil) {
self.aBannerView.hidden = NO;
}
}
- (void)adView:(GADBannerView *)view didFailToReceiveAdWithError:(GADRequestError *)error {
NSLog(@"Failed to receive ad with error: %@", [error localizedFailureReason]);
[self.aBannerView removeFromSuperview];
[self showInhouseAd];
}
- (void)adViewWillLeaveApplication:(GADBannerView *)bannerView {
}
- (void)dealloc {
[aBannerView release];
}
谢谢,
答案 0 :(得分:1)
选择器名称对我来说似乎很明确。尝试在释放横幅视图之前将委托设置为nil:
- (void)dealloc {
[aBannerView setDelegate:nil];
[aBannerView release];
}
答案 1 :(得分:0)
因为错误实际上是[GADDelegateManager didYouNilOutYourDelegate:selector:]
。我实际上会尝试
- (void)dealloc
{
aBannerView.delegate = nil;
[aBannerView release];
}
这似乎是您的问题,如错误消息所示。