Properly hiding iAds

Discussion in 'iOS Programming' started by chainprayer, Jul 18, 2010.

  1. chainprayer
    Expand Collapse
    macrumors 6502a

    Feb 10, 2008
    My app was recently rejected after implementing iAd support. The email I received back stated I needed to hide the view when no ad was present. The following was provided:

    I tried adding that to my main view controller that contains the ad view and received many compile error messages. What would be the proper way of hiding the ads?

    EDIT: Yes I am compiling with the most recent SDK and I have included the iAd framework
  2. dejo
    Expand Collapse


    Staff Member

    Sep 2, 2004
    The Centennial State
  3. LastLine
    Expand Collapse
    macrumors 65816

    Aug 24, 2005
    OK so stage 1 is simple. Remove all the iAd code and frameworks from your app. Seriously.

    Second stage.
    Download This Video from the WWDC 2010 series, it's all based around iAd.

    Watch through and observe the "Ideal Implementation" otherwise known as "the only way you're getting your iAd app on our store Implementation" this describes it faultlessly, worked an absolute charm for me.

    Hope that helps, it was ages of hunting before I got it right and that does it so simply.
  4. themoonisdown09
    Expand Collapse
    macrumors 601


    Nov 19, 2007
    Georgia, USA
    Apple's iAd Programming Guide will show you how to properly display and hide the iAd banner. This is how I got mine working.
  5. tdog09
    Expand Collapse
    macrumors member

    Jul 13, 2008

    Agreed, it's a great video, watch it!

    Also, have any of you received this warning when click on the iAd banner:

    The view controller <ADRemoteViewController: 0x176d00> returned NO from -shouldAutorotateToInterfaceOrientation: for all interface orientations. It should support at least one orientation.
  6. chainprayer
    Expand Collapse
    thread starter macrumors 6502a

    Feb 10, 2008
    Thanks for the video! Very helpful!

    I am encountering an error for the - (void)moveBannerViewOffScreen section. The line that reads self.bannerview.frame = newBannerFrame; is returning an error that states "Request for member 'bannerview' is something not a structure or union." Any ideas on how to resolve this?

    Thanks! :D
  7. TuffLuffJimmy
    Expand Collapse
    macrumors G3


    Apr 6, 2007
    Portland, OR
    I read the title as "Properly hiding Aids" and I thought "ehhhhh....?"
  8. Thomas Harte
    Expand Collapse
    macrumors 6502

    Nov 30, 2005
    That would imply that your class does not have an exposed getter for a member named bannerview. Replace self.bannerview with whatever means provides you with the ADBannerView object; if you've placed it in Interface Builder rather than created it programmatically it'll be the associated outlet (or you'll need to create one). Exactly the same as for talking to any other view.
  9. DennisVar
    Expand Collapse
    macrumors newbie

    Jun 21, 2010
    One other gotcha is that you must make sure that the class with the didFailToReceiveAdWithError method is a delegate for your iAd banner view.

    You can do this in Interface Builder by making the appropriate attachment, or do something like this in your code:

    self.bannerView.delegate = self;
    The code above assumes that didFailToReceiveAdWithError is placed in the same view controller that has your banner view, of course.

Share This Page