swift - RevMob 横幅广告不会显示

标签 swift revmob

好吧,这是我正在使用的代码,但横幅广告似乎无法加载。测试模式已开启,但什么也没有显示。

let completionBlock: () -> Void = {
    //Custom method defined below
    self.banner?.showAd()
    self.bannerView?.showAd()

}
let failureBlock: (NSError!) -> Void = {error in
    print("Gifting Chaos Session failed to start with error: \(error.localizedDescription)")
}

RevMobAds.startSession(withAppID: "myKEY", withSuccessHandler: completionBlock, andFailHandler: nil)
bannerView? = RevMobAds.session().bannerView()
let x = CGFloat(0)
let y = CGFloat(0)
let width = CGFloat(375)
let height = CGFloat(50)
self.bannerView?.frame = CGRect(x: x, y: y, width: width, height: height)
bannerView?.loadAd()
bannerView?.showAd()
banner?.releaseAd()
self.banner?.showAd()

最佳答案

我相信你的代码有点令人困惑。您调用 showAd()releaseAd()。您可以尝试仅在完成 block 中显示广告吗?另请尝试使用我们的示例应用程序并遵循我们的文档 here

您没有发送 viewController 中的代码,但您还必须在 Controller 的 View 中添加横幅。

关于swift - RevMob 横幅广告不会显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40894706/

相关文章:

ios - RevMob不起作用

android - 如何将 RevMob 与 LibGdx 集成

ios - UICollectionViewCell 中托管的 UITableViewController 的滚动问题

swift - 为什么 self 在 init() 方法中被允许,即使它未通过安全检查?

ios - 每两次点击按钮时显示一次全屏广告

ios - 我必须重新加载 RevMob 广告吗?

swift - 推送到 git 后链接的 FrameWork 和库变灰

swift - 我可以强制评估@autoclosure 参数吗?

swift - 在不同模块中定义泛型时无法推断泛型参数