【发布时间】:2020-04-13 12:47:54
【问题描述】:
我试图在我的应用中使用 AdMob 插页式广告。在各种互联网资源和自学的指导和帮助下,我能够在 android 版本中实现这一点。我遇到了 iOS 实现的问题。
经过一番努力,我能够使用适用于 iOS 的“移动广告 SDK”来加载“广告”。我的测试应用程序编译,它甚至获取广告。但是,在将广告展示到屏幕上时,它似乎不起作用。
我尝试使用以下命令显示广告。
procedure TForm8.btnShowAdClick(Sender: TObject);
begin
{$ifdef android}
FInterstitial.show;
{$endif}
{$ifdef ios}
if FInterstitial.isReady
then begin
ShowMessage ('Showing');
FInterstitial.presentFromRootViewController
(TiOSHelper.SharedApplication.keyWindow.rootViewController);
end
else ShowMessage ('Not Ready');
{$endif}
end;
对此没有任何反应。根据文档,广告应在致电 presentFromRootViewController 后立即显示。我收到“显示”消息,但没有任何反应。我还可以看到,我的interstitialWillPresentScreen 的侦听器正在被调用;这意味着它正在尝试展示广告,但出于某种原因,它没有。
我尝试通过nil 而不是TiOSHelper.SharedApplication.keyWindow.rootViewController,但没有成功。
我正在使用 Google 的 iOS 测试广告单元 ID ca-app-pub-3940256099942544/4411468910 进行测试。我 100% 确定我正在获取广告。每次获取广告时,我都会通过检查FInterstitial.responseInfo.responseIdentifier 来确认这一点。它不只是显示出来...帮助!!!
【问题讨论】:
标签: ios delphi ads interstitial