RevMob banner ads won't display

2019-09-15 11:07发布

问题:

Alright so this is the code I'm using but banner ads won't seem to load up. Testing mode is on but nothing shows up at all.

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()

回答1:

I believe your code is a bit confusing. You call showAd() and also releaseAd(). Could you try to just show the ad in the completion block? Also try using our Sample App and follow our documentation here

You didn't send the code that is in your viewController, but you also have to add the banner in your controller's view.



标签: swift revmob