ios - 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
解决方案
推荐阅读
- r - 如何在R中将数据结构从整数转换为字符?
- python - 需要查找除.dat文件外的文件夹和子文件夹中的文件数
- python - 计算复利
- java - 使用 AWS-SQS 的 JavaCallable-Future 的并发特性
- kubernetes - 使用共享卷在同一 Pod 中的容器之间进行通信
- python - 在符合特定标准的 XYZ 值网格中找到两个节点之间的连续路径
- python - 如何比较两个文件夹、子文件夹和文件的相对路径,并将所有匹配文件的绝对路径传递给函数?
- laravel - Laravel 异步使用 spatie/async
- graphql - 从石墨烯模式中获取查询字符串?
- angular - 带有 ldapjs polyfill 错误的 Angular 12