ios - 在我的 iOS 应用程序中实现 AdMob,出现错误,无法显示广告

标签 ios swift admob

swift 4.2,iOS 12.x

尝试在我的应用中实现 AdMob,但进展并不顺利。

  1. 创建了一个 adMob 帐户,看起来还不错?
  2. 将 NSAppTransportSecurity key 添加到 info.plist 好吗?
  3. 添加此代码以加载横幅添加成功。

    bannerView = GADBannerView(adSize: GADAdSize(size: CGSize(width: 320, height: 50), flags: 0), origin: CGPoint(x: 0, y: 0))
    bannerView.adUnitID = "ca-app-pub-A/B" // changed this code in this post
    bannerView.rootViewController = self.view?.window?.rootViewController
    bannerView.delegate = self
    let request = GADRequest()
    request.testDevices = [ kGADSimulatorID ]
    bannerView.load(request)
    self.view?.window?.rootViewController?.view.addSubview(bannerView)
    

支持 GADBannerViewDelegate 的扩展类;接到回电说错误,没有广告显示。控制台实际上报告了这一点。

2018-12-18 11:49:35.468445+0100 DeX[1547:900808] WF: _WebFilterIsActive returning: YES 2018-12-18 11:49:35.468729+0100 DeX[1547:900808] WF: _userSettingsForUser mobile: { filterBlacklist = ( ); filterWhitelist = ( ); noOverridingAllowed = 1; restrictWeb = 1; useContentFilter = 1; useContentFilterOverrides = 0; whitelistEnabled = 0; } 2018-12-18 11:49:35.468821+0100 DeX[1547:900808] WF: Checking if https://googleads.g.doubleclick.net/mads/static/sdk/native/sdk-core-v40.html is in contentFilterOverriddenBlackList 2018-12-18 11:49:35.469159+0100 DeX[1547:900808] WF: Checking if https://googleads.g.doubleclick.net/mads/static/sdk/native/sdk-core-v40.html is in contentFilterOverriddenWhiteList 2018-12-18 11:49:35.513610+0100 DeX[1547:900808] WF: * WFLSMMap initWithMap: unable to retrieve threshold from map file. 2018-12-18 11:49:35.518259+0100 DeX[1547:900808] WF: WFLSMScoreNormalizedMap category:1 min:0.338760 max:0.663066 scope:0.324306 2018-12-18 11:49:35.518377+0100 DeX[1547:900808] WF: WFLSMScoreNormalizedMap category:2 min:0.336934 max:0.661240 scope:0.324306 2018-12-18 11:49:35.518439+0100 DeX[1547:900808] WF: +[WFJudge defaultJudge] map:/System/Library/PrivateFrameworks/WebContentAnalysis.framework/content_filter_map3 2018-12-18 11:49:35.518559+0100 DeX[1547:900808] WF: Page not worth analyzing [pageContent length]:7 [[self images] count]==0 [[self scriptBlocks] count]:2 2018-12-18 11:49:35.518693+0100 DeX[1547:900808] WF: WebFilterEvaluator:addData: https://googleads.g.doubleclick.net/mads/static/sdk/native/sdk-core-v40.html is not blocked: 'googleads.g.doubleclick.net' is not explicit 2018-12-18 11:49:35.518760+0100 DeX[1547:900808] WF: WebFilterEvaluator:addData: 'googleads.g.doubleclick.net' at https://googleads.g.doubleclick.net/mads/static/sdk/native/sdk-core-v40.html is not blocked * error *** Request Error: No ad to show.

我在这里错过了什么?昨天下午创建了帐户,距离我创建还不到 24 小时?

最佳答案

尝试将限制广告跟踪(在设置/隐私/广告中)设置为关闭。

关于ios - 在我的 iOS 应用程序中实现 AdMob,出现错误,无法显示广告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53831606/

相关文章:

ios - 为什么在 SwiftUI 中,当用 .sheet 呈现模态视图时,init() 被调用两次

ios - 直接写入已连接的CBPeripheral,无需重新发现它

ios - Firebase 使用电子邮件和密码创建用户给我字符串必须解包错误

java - 广告不可见。不刷新广告

Android 项目构建目标大于其预期工作目标

objective-c - UIButton UIControlEventTouchUpInside 不会触发,但 UIControlEventTouchDown 会触发

ios - 一旦安装到 Xcode 项目中就无法使用 cocoa pod 模块

swift - Mac Catalyst 上的系统分组背景颜色对于 Light Mode 不正确

ios - UIView.animate 没有为我的 UIVisualEffectView 设置动画

swift - 如果结构项等于 nil