I\'ve built my app this way and everything seems to be working more or less. After hearing about the notoriously low iAd fill rate I decided that this would be the best meth
I ended up with this strategy:
first of all I have created 2 outlets from the storyboard, one for the ADBannerView
and another for the GADBannerView
@IBOutlet weak var iadBannerView: ADBannerView!
@IBOutlet weak var adMobBannerView: GADBannerView!
In your viewDidLoad you can do this:
override func viewDidLoad() {
super.viewDidLoad()
self.iadBannerView.hidden = true
self.adMobBannerView.hidden = true
self.iadBannerView.delegate = self
NSTimer.scheduledTimerWithTimeInterval(35, target: self, selector: Selector("dispalyGoogleBanner"), userInfo: nil, repeats: false)
}
So here you hidden both banners (if you prefer you can do it directly in storyboard). then you wait 35 second before to display the google ads. So before to display the google ads you basically want to see if iAD it's available.
this is the method used to display the google banner:
//MARK: - Google banner
func dispalyGoogleBanner() {
if !self.isDisplayIAD && !idDisplayADMob {
idDisplayADMob = true
self.adMobBannerView.adUnitID = kAdUnitID
self.adMobBannerView.hidden = false
self.adMobBannerView.rootViewController = self
self.adMobBannerView.loadRequest(GADRequest())
}
}
so before to display the google banner, we ensure that the iAD banner and the adMob banner are not displayed yet. If that it's the case, then we can send the request to display the ADMob banner.
Here my implementation of the ADBannerViewDelegate
func bannerViewDidLoadAd(banner: ADBannerView!) {
self.iadBannerView = banner
self.iadBannerView.hidden = false
self.adMobBannerView.hidden = true
idDisplayADMob = false
self.view.layoutIfNeeded()
}
func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError
error: NSError!) {
println(error)
isDisplayIAD = false
self.iadBannerView.hidden = true
self.dispalyGoogleBanner()
}
func bannerViewActionDidFinish(banner: ADBannerView!) {
self.iadBannerView = banner
self.iadBannerView.hidden = true
isDisplayIAD = false
dispalyGoogleBanner()
}
func bannerViewWillLoadAd(banner: ADBannerView!) {
//remove the google banner if displayed
isDisplayIAD = true
self.iadBannerView.hidden = false
self.adMobBannerView.hidden = true
idDisplayADMob = false
self.view.layoutIfNeeded()
}
what I basically did on these delegates it's to check if the iAD banner it's available, if that it's case then I'll hidden the adMob banner. If the iAD finished to display the ads, then I'll call the ADMob banner see bannerViewActionDidFinish
You can easily adapt this logic tu your implementation.