Alexander Khitev
Alexander Khitev

Reputation: 6851

iAd appear in different places

I in first time make iAd. I placed iAd banner in the top of UIViewController, but when I launch app, iAd is in the bottom of UIViewController. I made constraints. Still I want to tell that sometimes iAd appear in the right place. I tried on simulator, iPhone 5s and iPad 3 with Cellular.

This is code which I wrote

    @IBOutlet weak var banner: ADBannerView!

func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
    NSLog("Banner View error is %@", error)
}

func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool {
    return true
}

func bannerViewDidLoadAd(banner: ADBannerView!) {
    banner.hidden = false
    NSLog("Banner is loaded")
}

Screenshots enter image description here enter image description here

I also add iAd to my player, and I even put iAd in specific UIView and set constraints but iAd all the same appear in the bottom of UIViewController These screenshots show it.

Upvotes: 1

Views: 38

Answers (2)

Daniel Storm
Daniel Storm

Reputation: 18878

If you're implementing your own ADBannerView then you need to remove self.canDisplayBannerAds = true from your viewDidLoad.

self.canDisplayBannerAds = true can be used for a no hassle way of implementing iAd banners in your application. This will create an ADBannerView for you and show or hide the ADBannerView on the bottom of your view depending on whether it receives an ad or not from the iAd network.

You either implement your own ADBannerView or use self.canDisplayBannerAds = true, not both.

Upvotes: 1

Alexander Khitev
Alexander Khitev

Reputation: 6851

I removed the following code can self.definesPresentationContext = true from viewDidLoad and it works for me.

Upvotes: 0

Related Questions