I've used the same code on all my apps to display iAd ads, but after downloading xcode 7 and converting my code to swift2, ads don't appear anymore on my device or on the xcode simulator. Does anyone know what changes need to be made?
import UIKit
import SpriteKit
import iAd
class GameViewController: UIViewController, ADBannerViewDelegate {
var adBanner: ADBannerView? = ADBannerView()
override func viewDidLoad() {
super.viewDidLoad()
adBanner?.delegate = self
adBanner?.hidden = true
self.canDisplayBannerAds = true
}
func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
adBanner?.hidden = true
}
func bannerViewDidLoadAd(banner: ADBannerView!) {
adBanner?.hidden = false
}
func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool {
return willLeave
}
}
Have you considered iAd network to be down at the very moment? Always keep a copy of Apples own iAd Suite at hand: https://developer.apple.com/library/ios/samplecode/iAdSuite_Storyboard/Introduction/Intro.html
If their own dont't load, yours won't load either.
Right now I'm getting this self explanatory error message:
NSLocalizedFailureReason=Ad inventory unavailable
Hope that helps.