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

标签 iphone objective-c ios xcode iad

这是我的问题。我有一个使用 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/

相关文章:

iphone - iOS - 用按钮反转 UIImage

iOS 手机应用程序 : third party app integration like Viber/WhatsApp

objective-c - 如何在 objective-c 中声明全局变量

ios - 突出显示 UITextView 中的文本

ios - 使用 Metal 有效计算 UIImage/CIImage 中有多少透明像素

iphone - 学习 Obj-C 内存管理

iphone - Uisegmentedbar 固定在 uitableview 上方

objective-c - 无法将表达式的类型 'Void' 转换为类型 'String!'

ios - 如何通过 iMessage ios 8 发送音频文件

iphone - 这是允许的吗?通过 XML-RPC 在 iOS 上更新内容