首页 > 解决方案 > iOS Admob 打开应用程序广告问题,下方有黑色背景

问题描述

我实施了开放式应用广告(此处的视频:https ://www.youtube.com/watch?v=bnqs2A1ff1k&feature=youtu.be )

这看起来像官方指南中的第一个“不鼓励实施示例”:https: //support.google.com/admob/answer/9341964?hl=en

在下面不鼓励使用的示例中,广告被放置在加载屏幕之后,并且广告下方没有可见的内容。

我只是像这样在加载屏幕中调用 present :

[ad presentFromRootViewController:rootController]

请注意,viewDidDisappear我的加载屏幕的调用就像呈现任何普通视图控制器一样,这当然会隐藏加载屏幕。

我想知道如何将原始加载屏幕保留在广告下方?

编辑:我写了一些虚拟代码来演示它:

#import "ViewController.h"
@import GoogleMobileAds;

@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];
  
  // this is a dummy loading screen with bg color
  self.view.backgroundColor = UIColor.blueColor;
  
  [GADAppOpenAd loadWithAdUnitID:@"ca-app-pub-3940256099942544/3419835294" request:[GADRequest request] orientation:UIInterfaceOrientationPortrait completionHandler:^(GADAppOpenAd * _Nullable appOpenAd, NSError * _Nullable error) {

    // dummy 3 seconds loading duration
    [NSTimer scheduledTimerWithTimeInterval:3.0f repeats:NO block:^(NSTimer * _Nonnull timer) {
      
      // present the ad, notice the black color behind the open app ad
      // i.e. the loading screen is gone
      // this is just like the first "Discouraged implementation example" here: https://support.google.com/admob/answer/9341964?hl=en
      [appOpenAd presentFromRootViewController:self];
    }];
  }];
}

@end

标签: iosuikitadmob

解决方案


推荐阅读