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