我目前正在收到一个让我的应用程序退出应用程序商店的崩溃,这似乎发生在我创建一个谷歌广告作为iAd的后退。 它只发生在兼容模式下运行IOS 6.0 - 6.1的I-pad(应用程序不是通用的),它似乎发生在: [googleAdvertBanner loadRequest:releaseRequest];
任何帮助都会非常感激,这就是我崩溃时代码视图中的内容:
GADMAdNetworkConnectorImpl.m:95
0x49e008: addl $60, %esp --- Thread 1:EXEC_BAD_ACCESS (code=2, address=0xf)
日志显示以下内容:
DBannerView: Unhandled error (no delegate or delegate does not implement didFailToReceiveAdWithError:): Error Domain=ADErrorDomain Code=3 "The operation couldn’t be completed. Ad inventory unavailable" UserInfo=0x13c9e380 {ADInternalErrorCode=3, ADInternalErrorDomain=ADErrorDomain, NSLocalizedFailureReason=Ad inventory unavailable}
我的广告处理应用代码:
#pragma mark Ad Banner Delegate
#pragma mark -
- (void)bannerViewDidLoadAd:(ADBannerView *)banner{
// remove the google advert banner
[googleAdvertBanner removeFromSuperview];
// dont use auto resizing mask for constraints
advertBanner.translatesAutoresizingMaskIntoConstraints = NO;
// scroll the ad bar
[self moveViews:adView down:YES];
//NSLog(@"IAD advert has SUCCEEDED");
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{
// scroll the ad bar
[self moveViews:adView down:NO];
// create the google advert
[self createGoogleAdvert];
//NSLog(@"IAD advert has FAILED");
}
- (void)bannerViewActionDidFinish:(ADBannerView *)banner{
}
#pragma mark GoogleAd Banner Delegate
#pragma mark -
- (void)adViewDidReceiveAd:(GADBannerView *)view{
// dont use auto resizing mask for constraints
googleAdvertBanner.translatesAutoresizingMaskIntoConstraints = NO;
// add the google advert banner
[adView addSubview:googleAdvertBanner];
// scroll the ad bar
[self moveViews:adView down:YES];
//NSLog(@"Google advert has SUCCEEDED");
}
- (void)adView:(GADBannerView *)view didFailToReceiveAdWithError:(GADRequestError *)error{
// remove the google ad and instantiate the apple advert
[googleAdvertBanner removeFromSuperview];
// scroll the ad bar
[self moveViews:adView down:NO];
//NSLog(@"Google advert has FAILED");
}
- (void)adViewDidDismissScreen:(GADBannerView *)adView{
}
#pragma mark Create GoogleAd Banner
#pragma mark -
- (void)createGoogleAdvert{
// if the googleadvert banner has not been initiated
if (!googleAdvertBanner) {
// create google advert banner
googleAdvertBanner = [[GADBannerView alloc]initWithAdSize:kGADAdSizeBanner];
}
// set the ads "unit identifier", delegate and root view controller
googleAdvertBanner.adUnitID = @"myid which is correct";
googleAdvertBanner.delegate = self;
googleAdvertBanner.rootViewController = self;
// test request
//GADRequest *testRequest = [GADRequest request];
//testRequest.testDevices = [NSArray arrayWithObjects:GAD_SIMULATOR_ID, @"0525457c40445ae54cac4f282ba0d409", nil];
// release request
GADRequest *releaseRequest = [GADRequest request];
// load the request
[googleAdvertBanner loadRequest:releaseRequest];
}
答案 0 :(得分:0)
尝试在执行GADRequest之前检查互联网可访问性。我有离线加载adMob横幅时崩溃的经验。
if ([[Reachability reachabilityForInternetConnection] isReachable]) {
//... banner init etc
// release request
GADRequest *releaseRequest = [GADRequest request];
// load the request
[googleAdvertBanner loadRequest:releaseRequest];
}
答案 1 :(得分:0)
好的,我想我解决了这个问题:
我让我的admob中介也服务于iAd以及adbannerview,我相信在低端IOS版本6.0-6.1当介导的iAd失败时它无法调用failedToLoad因为adbannerview不存在或者它根本无法运行该方法,从我的admob设置中删除中介解决了崩溃。