我在我的应用中使用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];
}


谢谢,

最佳答案

选择器名称对我来说似乎很解释。在释放标题视图之前,尝试将委托设置为nil:

- (void)dealloc {
    [aBannerView setDelegate:nil];
    [aBannerView release];
}

关于ios - 如何修复GADDelegateManager didYouNilOutYourDelegate:selector:错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19377613/

10-09 17:20