dismissModalViewController с iAds.В баннере есть реклама, но она может быть скрыта - PullRequest
1 голос
/ 01 сентября 2011

Вот моя проблема.У меня есть экран входа в систему, который отображается с помощью PresentModalViewAnimated.Когда пользователь входит в систему, он отклоняется.

На экране входа в систему у меня есть 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.
}

1 Ответ

0 голосов
/ 20 июня 2012

Я думаю, что с этим вы могли бы устранить ошибку.Просто удалите вид баннера в ViewWillDisappear:

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