2013-09-03 3 views
2
에서 표시되지

말게 오류 :의 iAd는 지난 몇 일

Error Domain=ADErrorDomain Code=3 "The operation couldn’t be completed. Ad inventory unavailable" 
UserInfo=0x118bb420 {ADInternalErrorCode=3, ADInternalErrorDomain=ADErrorDomain, NSLocalizedFailureReason=Ad inventory unavailable} 

당신이 나에게 그 내 코딩 문제를 알려 주시기 바랍니다 수 또는 애플 사이트 형태의 문제인가?

저는 App Delegate에 iAd 개체를 할당하고 있는데 위임자는 App Delegate에도 있습니다. 여기 코드는 다음과 같습니다 - 추상 UIViewConroller 클래스에서

AppDelegate *appDel=(AppDelegate*)[UIApplication sharedApplication].delegate; 
CGRect rect1 = CGRectMake(0.0,300,320,50); 
appDel.adBanner = [[ADBannerView alloc] initWithFrame:rect1]; 
appDel.adBanner.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait]; 
appDel.adBanner.currentContentSizeIdentifier =  ADBannerContentSizeIdentifierPortrait; 
[appDel.adBanner setHidden:YES]; 
appDel.adBanner.delegate = self; 

- (void)bannerViewDidLoadAd:(ADBannerView *)banner 
{ 
    AppDelegate *app=(AppDelegate*)[UIApplication sharedApplication].delegate; 
    NSLog(@"iAd load"); 
    app.adBanner.frame=CGRectMake(0.0,300,320,50); 
    app.adBanner.hidden=NO; 
} 

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error 
{ 
    AppDelegate *app=(AppDelegate*)[UIApplication sharedApplication].delegate; 
    NSLog(@"iAd error: %@", error); 
    app.adBanner.hidden=YES; 
    app.adBanner.frame=CGRectMake(0.0,350,0,0); 
} 

그리고 내가 추가하고 배너 도움을 사전에

CGFloat y=0; 
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) 
{ 
    CGSize result = [[UIScreen mainScreen] bounds].size; 
    y=result.height; 
} 
AppDelegate *app=(AppDelegate*)[UIApplication sharedApplication].delegate; 
CGRect rect2 = CGRectMake(0.0,y-50,320,50); 
app.adBanner.frame =rect2; 
UIViewController *topController = [UIApplication  sharedApplication].keyWindow.rootViewController; 
[topController.view addSubview:app.adBanner]; 

감사합니다.

+0

http://stackoverflow.com/questions/8403951/iads-giving-adinternalerrorcode-3-inventory-unavailable- 100-of-the-time? rq = 1 이것을 참조하십시오. –

답변

0

시뮬레이터에서 테스트 중입니까? 아마도이 문제는 iOS 시뮬레이터에서 iAd를 테스트 할 때 도메인에 있습니다. 기기에서 테스트 해보세요. 문제가 지속되면 문제의 코드를 추가하여 실제 문제의 위치를 ​​파악하세요.

+1

장치에도 문제가 여전히 있습니다. 내 코드를 추가했습니다. 네가 나를 도울 수 있다면 너에게 고마워. – vntstudy

관련 문제