swift 4.2,iOS 12.x
尝试在我的应用中实现 AdMob,但进展并不顺利。
- 创建了一个 adMob 帐户,看起来还不错?
- 将 NSAppTransportSecurity key 添加到 info.plist 好吗?
添加此代码以加载横幅添加成功。
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/