ADBannerView not showing up

| | August 10, 2015

I’m trying to put iAd Banner into my game! I’ve been starring at the game for quite a while to wait for the normal Apple iAd advertisement to come up but it hasn’t. It isn’t appearing on my screen at all!

Am I doing something wrong?

Or will it appear eventually?

import iAd

var iAdBanner = ADBannerView()

var bannerVisible = false

class GameViewController: UIViewController, ADBannerViewDelegate{

override func viewDidLoad() {

    if let scene = GameScene.unarchiveFromFile("GameScene") as? GameScene {
        // Configure the view.
        let skView = self.view as SKView
        /* Set the scale mode to scale to fit the window */
        scene.scaleMode = .AspectFill

        iAdBanner.frame = CGRectMake(0, self.view.frame.size.height, self.view.frame.width, 50)
        iAdBanner.delegate = self
        bannerVisible = false

// Show banner, if Ad is successfully loaded.
func bannerViewDidLoadAd(banner: ADBannerView!) {
    if(bannerVisible == false) {

        // Add banner Ad to the view
        if(iAdBanner.superview == nil) {

        // Move banner into visible screen frame:
        UIView.beginAnimations("iAdBannerShow", context: nil)
        banner.frame = CGRectOffset(banner.frame, 0, -banner.frame.size.height)

        bannerVisible = true


// Hide banner, if Ad is not loaded.
func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
    if(bannerVisible == true) {
        // Move banner below screen frame:
        UIView.beginAnimations("iAdBannerHide", context: nil)
        banner.frame = CGRectOffset(banner.frame, 0, banner.frame.size.height)
        bannerVisible = false


2 Responses to “ADBannerView not showing up”

  1. maybe check your storyboard–> your viewcontroller which contains iAd –> view attributes inspector tab –> focus on Extend Edges, & uncheck this attribute. Hope this help. Tks for reading this answer.

  2. You have not added the banner view to your view. You have called self.view.addSubview(iAdBanner) in bannerViewDidLoadAd which will not get called before adding the banner view. You need to add the banner view beforehand (e.g. in viewDidLoad).

    Also, you cant change the banner view frame to any size you want .

    Read through the Banner View Sizes in iAD Programming Guide (actually read the entire guide). It has code snippets (in ObjC not Swift though).

    It clearly says :

    iAd supports different banner sizes for portrait and landscape apps.
    The exact size of advertisements depends on the device the banner is
    being shown on. On an iPhone, a portrait advertisement is 320 x 50
    points and 480 x 32 points for a landscape advertisement. On an iPad,
    a portrait advertisement is 768 x 66 points and 1024 x 66 points for a
    landscape advertisement. In the future, additional sizes may be
    exposed by iAd.

    And in the next paragraph:

    To ensure that advertisements are displayed properly, a banner view
    must always be sized to match one of the built-in advertising sizes.
    The ADBannerView class enforces this by preventing you from changing
    the frame directly. Instead, you change a banner view’s frame by
    setting the currentContentSizeIdentifier property. Changing the value
    stored in this property resizes the banner view’s frame to the match
    the size for the provided identifier.

Leave a Reply