import iAd
@IBOutlet weak var Banner: ADBannerView!
override func viewDidLoad() {
super.viewDidLoad()
Banner.hidden = true
Banner.delegate = self
self.canDisplayBannerAds = true
}
func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool {
return true
}
func bannerViewDidLoadAd(banner: ADBannerView!) {
self.Banner.hidden = false
}
func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
NSLog("Error")
}
func bannerViewWillLoadAd(banner: ADBannerView!) {
}
Hello, I am currently developing an iOS app with Xcode 7.2, Swift 2.0, and iOS 9.2. I have implemented iAds, and it works perfectly. However in my region the fill rate is not high, and I would like to use Google's AdMob to advertise on my app, as a backup. I would like for the AdMob banner ad to show up when iAd does not receive an ad. Note that I am new to Swift, and have no knowledge of Objective-C. Thanks.
You can load the AdMob ad (and view) in the didFailToReceiveAdWithError
. supposing that this callback will be called when no iAd is available (I think so).