gpt4 book ai didi

iphone - dismissModalViewController 与 iAds。横幅 View 有广告但可能被遮挡

转载 作者:行者123 更新时间:2023-11-28 17:43:14 25 4
gpt4 key购买 nike

这是我的问题。我有一个使用 PresentModalViewAnimated 显示的登录屏幕。一旦用户登录,它就会被关闭。

在登录屏幕上我有一个 iAd 但是当它被关闭时我得到这个错误。

ADBannerView: WARNING A banner view (0x5a37df0) has an ad but may be obscured. This message is only printed once per banner view

同样,当我登录然后退出时,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.
}

最佳答案

我认为您可以用它来消除错误。只需删除 ViewWillDisappear 中的横幅 View :

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

关于iphone - dismissModalViewController 与 iAds。横幅 View 有广告但可能被遮挡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7271032/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com