IAd not download xcode7 ads

I used the same code for all my applications to serve iAd ads, but after downloading xcode 7 and converting my code to swift2, ads no longer appear 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
    }

}
+4
source share
2 answers

Do you think the iAd network is not working right now? Always keep a copy of Apple iAd Suite on hand: https://developer.apple.com/library/ios/samplecode/iAdSuite_Storyboard/Introduction/Intro.html

If their own does not load, yours will not load.

:

NSLocalizedFailureReason=Ad inventory unavailable

, .

0

. iAd. -, iAd, , iAd . :

    self.canDisplayBannerAds = true     

- , . :

var adBanner: ADBannerView? = ADBannerView(adType: ADAdType.Banner)
adBanner?.delegate = self

, , , :

func bannerViewDidLoadAd(banner: ADBannerView!) {
    self.view.addSubview(banner)
}

hidden .

0

Source: https://habr.com/ru/post/1607948/


All Articles