1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Properly hiding iAds

Discussion in 'iPhone/iPad Programming' started by chainprayer, Jul 18, 2010.

  1. macrumors 6502a

    chainprayer

    #1
    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. Moderator

    dejo

    Staff Member

    #2
    What errors are you getting?
     
  3. macrumors 65816

    #3
    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. macrumors 601

    themoonisdown09

    #4
    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. macrumors member

    #5

    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. macrumors 6502a

    chainprayer

    #6
    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. macrumors G3

    TuffLuffJimmy

    #7
    I read the title as "Properly hiding Aids" and I thought "ehhhhh....?"
     
  8. macrumors 6502

    #8
    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. macrumors newbie

    #9
    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:

    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