Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

chainprayer

macrumors 6502a
Original poster
Feb 10, 2008
638
2
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:

Banner View Delegate to Remove a Banner View When Advertisements are Not Available:

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
if (self.bannerIsVisible)
{
[UIView beginAnimations:mad:"animateAdBannerOff" context:NULL];
// assumes the banner view is at the top of the screen.
banner.frame = CGRectOffset(banner.frame, 0, -50);
[UIView commitAnimations];
self.bannerIsVisible = NO;
}
}

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
 
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.
 
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.


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.
 
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
 
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

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.
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.