Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Google Admob横幅广告未加载AnchorType.top_Ios_Flutter_Banner Ads - Fatal编程技术网

Ios Google Admob横幅广告未加载AnchorType.top

Ios Google Admob横幅广告未加载AnchorType.top,ios,flutter,banner-ads,Ios,Flutter,Banner Ads,我在安卓商店上发布了一个Flutter应用程序。一切都是功能齐全的,包括横幅广告。我现在正试图让应用程序的苹果端正常工作,并一直在努力解决阻碍这一过程的无数苹果漏洞 我现在无法解决的是横幅广告。它们根本不会出现在iphone上。我遵循了本官方指南中的所有内容: 我已将Info.plist中的GADApplicationIdentifier设置为Admob中我的应用程序的应用程序ID 我在Info.plist中添加了GADIsAdManagerApp,并将其设置为YES 我在Info.plist中

我在安卓商店上发布了一个Flutter应用程序。一切都是功能齐全的,包括横幅广告。我现在正试图让应用程序的苹果端正常工作,并一直在努力解决阻碍这一过程的无数苹果漏洞

我现在无法解决的是横幅广告。它们根本不会出现在iphone上。我遵循了本官方指南中的所有内容:

我已将Info.plist中的GADApplicationIdentifier设置为Admob中我的应用程序的应用程序ID

我在Info.plist中添加了GADIsAdManagerApp,并将其设置为YES

我在Info.plist中添加了io.flatter.embedded_views_preview并将其设置为YES

我已经从门户网站下载了一个最新的GoogleService-info.plist文件,并将其添加到我的应用程序的runner文件夹中,但即使完成了所有这些步骤,我还是得到了:

也没有其他可能提供失败原因线索的信息

我的横幅代码(在Android中运行良好):

使用此设置,广告将完全无法在IOS上加载。如果我将此设置为底部,则广告加载完全正常。看起来像是又一个可怕的IOS错误,但我不知道如何解决这个问题,记住我需要在屏幕顶部显示横幅


有没有其他方法可以在不使用anchortype的情况下实现此定位???

屏幕截图:

如果您使用的是
AnchorType.top
请尝试以下操作:

myBanner
  ..load()
  ..show(
    anchorOffset: kToolbarHeight + 50, // 50 is the height of the banner ad
    anchorType: AnchorType.top, // it should work now because we have added offset
);
myBanner
  ..load()
  ..show(
    // it makes sure we are right below the AppBar, 50 is the height of Banner ad
    anchorOffset: queryData.size.height - kToolbarHeight - 50 - queryData.padding.top - queryData.padding.bottom,
    anchorType: AnchorType.bottom,
);

如果您使用的是
AnchorType.bottom
请尝试以下操作:

myBanner
  ..load()
  ..show(
    anchorOffset: kToolbarHeight + 50, // 50 is the height of the banner ad
    anchorType: AnchorType.top, // it should work now because we have added offset
);
myBanner
  ..load()
  ..show(
    // it makes sure we are right below the AppBar, 50 is the height of Banner ad
    anchorOffset: queryData.size.height - kToolbarHeight - 50 - queryData.padding.top - queryData.padding.bottom,
    anchorType: AnchorType.bottom,
);

测试(包括纵向和横向)

  • iPhone XS模拟器
  • iphone6s真实设备

您的横幅添加id正确吗?谢谢您的回复。复制并粘贴Admob中的应用程序ID,并验证其正确性。它在Android中工作得很好,所以它一定是。找到了问题的原因,如上面的编辑所述。仍然没有解决这个问题的方法。我不明白为什么会这样。@Bisclavret我从未使用过横幅广告,但听起来你是对的iOS中有一个错误,广告显示在
应用程序栏的上方,我添加了一个解决方案来修复它。