2011-09-01 67 views
1

繼承人我的問題。我有一個使用PresentModalViewAnimated顯示的登錄屏幕。一旦用戶登錄,它將被解僱。dismissModalViewController與iAds。橫幅視圖有廣告,但可能會被遮擋

在登錄屏幕上我有一個iAd,但當它被解僱時,我得到這個錯誤。

ADBannerView:警告甲橫幅視圖(0x5a37df0)具有一個廣告,也可以是 遮蔽。此消息僅在每個橫幅視圖中打印一次

此外,當我登錄後再登錄退出,iAd不再顯示。

我的代碼片段

@synthesize bannerIsVisible; 

- (void)bannerViewDidLoadAd:(ADBannerView *)banner 
{ 
    if (!self.bannerIsVisible) 
    { 
     [UIView beginAnimations:@"animateAdBannerOn" context:NULL]; 
     // banner is invisible now and moved out of the screen on 50 px 
     banner.frame = CGRectOffset(banner.frame, 0, 50); 
     [UIView commitAnimations]; 
     self.bannerIsVisible = YES; 
    } 
} 

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error 
{ 
    if (self.bannerIsVisible) 
    { 
     [UIView beginAnimations:@"animateAdBannerOff" context:NULL]; 
     // banner is visible and we move it out of the screen, due to connection issue 
     banner.frame = CGRectOffset(banner.frame, 0, -50); 
     [UIView commitAnimations]; 
     self.bannerIsVisible = NO; 
    } 
} 

- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave 
{ 
    NSLog(@"Banner view is beginning an ad action"); 
    BOOL shouldExecuteAction = YES; 
    if (!willLeave && shouldExecuteAction) 
    { 
     // stop all interactive processes in the app 
     // [video pause]; 
     // [audio pause]; 
    } 
    return shouldExecuteAction; 
} 

- (void)bannerViewActionDidFinish:(ADBannerView *)banner 
{ 
    // resume everything you've stopped 
    // [video resume]; 
    // [audio resume]; 
} 


    - (void)viewDidLoad 
{ 
    interestingTags = [[NSSet alloc] initWithObjects: INTERESTING_TAG_NAMES2]; //set interestingTag var to define 
    self.userArray = [[NSMutableArray alloc] init]; //init the userArray 

    adView = [[ADBannerView alloc] initWithFrame:CGRectZero]; 
    adView.frame = CGRectOffset(adView.frame, 0, -50); 
    adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait]; 
    adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait; 
    [self.view addSubview:adView]; 

    adView.delegate=self; 
    self.bannerIsVisible=NO; 

    [super viewDidLoad]; 
    // Do any additional setup after loading the view from its nib. 
} 
+0

了很多關於這個好信息已經可以在http://stackoverflow.com/questions/4160010/is-it-a-problem-when-an-iad -MAY的被遮蔽 – jwhat

回答

0

我認爲,這個你可以消除錯誤。就在ViewWillDisappear去除橫幅畫面:

-(void)viewWillDisappear:(BOOL)animated 
{ 
    [bannerView removeFromSuperview]; 
}