This is still a relatively new topic so not sure how many people have got to implement iAd on iPad (iOS4.2.1).
But basically, I get the iAd banner to appear in landscape mode (and it appears correctly). The only problem is when I click the "Test Advertisement" it shows the test advertisement in portrait mode. I.e., the device is still in landscape but the text and iad box itself that says "this confirms that test ads are running correctly" is sideways.
Is this normal? has anyone else experience this?
It almost seems like an apple bug but I'm not sure...
This happens to me, too. Apple's test ads on iPhone and iPad are portrait only. Real advertisements probably will support landscape mode.
the ADBannerView's requiredContentSizeIdentifiers is defaulted to have Landscape AND Portrait. If you are using landscape only, you must make a new NSSet with ADBannerContentSizeIdentifierLandscape
iAdView.requiredContentSizeIdentifiers = [NSSet setWithObjects:ADBannerContentSizeIdentifierLandscape, nil];
After doing this, the test ad with show up correctly.
I just had the same issue and in my case it was caused by not setting the rootViewController in the app delegate. Instead I had just added the controller's view directly to the window.
This behaviour can be reproduced by making a single change to the BasicBanner example from Apple's iAdSuite.
In AppDelegate.m change the line:
self.window.rootViewController = tvc;
to:
[self.window addSubview:tvc.view];
and the advertisement will always appear in portrait. Change the line back to setting the rootViewController and the ad will rotate appropriately.
Setting the rootViewController appears to be necessary for the iAd module to get device orientation notifications.
Along the way I noticed that the ad, or at least the test ad, only responds to the device orientation and does not respect the controller's interfaceOrientation at the time that the ad is invoked. If you run BasicBanner without the above mistake and with device laying flat and the app in landscape mode, the ad will appear in portrait and will not reorient to landscape until you tip up the device. The simulator behaviour is equally inconsistent.
I don't know whether this weakness is particular to just the test ad or all iAd ads.