bannerViewDidLoadAd is not called

| | August 18, 2015

iAD delegate never calls, although I set it in viewWillAppear.

in AppDelegate

var UIiAd: ADBannerView = ADBannerView()

in ViewController

var UIiAd: ADBannerView = ADBannerView()

 func appdelegate() -> AppDelegate {
    return UIApplication.sharedApplication().delegate as! AppDelegate

override func viewWillAppear(animated: Bool) {
    var SH = UIScreen.mainScreen().bounds.height

    UIiAd.delegate = self
    UIiAd = self.appdelegate().UIiAd
    UIiAd.frame = CGRectMake(0, SH - 50, 0, 0)

func bannerViewDidLoadAd(banner: ADBannerView!) {
    UIView.beginAnimations(nil, context: nil)
    UIiAd.alpha = 0.5

The funny think that adBanner actually show test advertising.

UDP: I did understand what was wrong. To display iAd, all you need is to set self.canDisplayBannerAds = true, thats it. But you don’t have any access to delegates of banned that was created.

One Response to “bannerViewDidLoadAd is not called”

  1. It appears that you instantiate a UIiAd as a property of your app delegate, and another UIiAd as a property of your viewController.

    UIiAd.delegate = self // The viewController's instance gets the delegate assigned
    UIiAd = self.appdelegate().UIiAd // The viewController's instance changes and becomes the same as the app delegate's instance

    This is not the way I’m used to deal with iAd, but in your case it might suffice changing the order of two lines of code:

    UIiAd = self.appdelegate().UIiAd
    UIiAd.delegate = self

    Hope this helps

Leave a Reply