2012-02-24 7 views
0

iAd 검색을 시도하는 앱이 있는데 실패 할 경우 AdMob 광고를로드합니다. 그것은 iPhone에서 완벽하게 작동하지만 iPad에서 실행할 때 앱이로드되지 못하게하는 연속 루프가 발생합니다. 지속적으로iPad에서 self.addSubView가 작동하지 않습니다.

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{ 

@try { 
    NSLog(@"Ad Error, looking for AdMob Ad..."); 

    // Create a view of the standard size at the bottom of the screen. 
    bannerView_ = [[GADBannerView alloc] 
        initWithFrame:CGRectMake(0.0, 
              self.view.frame.size.height - 
              GAD_SIZE_320x50.height, 
              GAD_SIZE_320x50.width, 
              GAD_SIZE_320x50.height)]; 

    // I know the banner size is incorret for iPad but it's only supposed to run 
    // on iPad in compatibility mode and changing doesn't help 

    // Specify the ad's "unit identifier." This is your AdMob Publisher ID. 
    bannerView_.adUnitID = @"XXXXXXX"; 


    // Let the runtime know which UIViewController to restore after taking 
    // the user wherever the ad goes and add it to the view hierarchy. 
    bannerView_.rootViewController = self; 
    [self.view addSubview:bannerView_]; 

    GADRequest *admobRequest = [GADRequest request]; 

    admobRequest.testDevices = [NSArray arrayWithObjects: 
           GAD_SIMULATOR_ID,        
           nil]; 

    // Initiate a generic request to load it with an ad. 
    [bannerView_ loadRequest: admobRequest]; 


    [iAdBanner setHidden: YES]; 
    [bannerView_ setHidden: NO]; 
} 
@catch (NSException *e) { 
    NSLog(@"Exception: %@", e); 
} 
@finally { 
} 
} 

NSLog 인쇄를 앱이로드되지 않습니다 여기에 몇 가지 코드가있다.

012-02-24 21:58:38.991 TrophyConverter Free[2948:15e03] Ad Error, looking for AdMob Ad... 
2012-02-24 21:58:38.992 TrophyConverter Free[2948:15e03] Ad Error, looking for AdMob Ad... 
2012-02-24 21:58:38.994 TrophyConverter Free[2948:15e03] Ad Error, looking for AdMob Ad... 

누구든지이 경험이 있습니까? 어떻게해야할까요? bool을 사용하여 연속 로그 인쇄를 중지하고 앱을로드했지만 광고는 표시되지 않았습니다.

편집 :이는 AdMob보기를 추가하는 부분이기 때문에 도움이되지 않습니다이 줄

[self.view addSubview:bannerView_]; 

을 제거 할 때 문제가 완전히 사라집니다.

또한 빌드 대상을 iPhone 앱이 아닌 범용 앱으로 변경해 보았습니다. 이 문제는 해결되지만 범용 앱이 아니기를 바라고 있으며 레이아웃을 만들지 않았습니다.

+0

무엇이 오류입니까? – MyztikJenz

+0

@MyztikJenz 오류 없음, didFailToReceiveAdWithError는 한 번 호출됩니다. [self.view addSubView : bannerView_]에 도달했습니다. 결코 끝나지 않는 루프와 같습니다. 결국 EXC_BAD_ACCESS가 발생하고 디버그 중에 self.view를 볼 수 없으므로 그 일과 관련이 있다고 생각합니다. 하지만 ARC를 사용하고 있습니다. 초기 릴리스가 없기 때문입니다. – Peter

+0

@MyztikJenz Apple에서 충돌 로그를 받으면 도움이됩니다. 나는 당신이 그들을 위해 일하는 것을 보았습니다 :) – Peter

답변

0

결국이 문제를 해결할 수 없습니다. 그래서 기본적으로 하나의 실패가 이루어지면 전환 된 bool을 추가했습니다. 수표가 발행되었지만 아직 수표가 발행되지 않은 경우 광고가 추가되지 않습니다.

관련 문제