开发者

iPhone & iAd: do I need to integrate this programmatically?

开发者 https://www.devze.com 2023-01-25 04:47 出处:网络
it looks like the library in the interface builder has an i开发者_开发技巧Ad I can drag into my .xib file. But this doesn\'t seem to be the right way since I\'m weak linking the iAd framework and pote

it looks like the library in the interface builder has an i开发者_开发技巧Ad I can drag into my .xib file. But this doesn't seem to be the right way since I'm weak linking the iAd framework and potentially devices that don't have iOS 4.0 won't work.

Therefore, I need to add the banner programmatically (i.e., NOT use the interface builder), correct?


Yes, you will probably need to programmatically create an ADBannerView instance if you wish to also support 3.x users. You could possibly do a runtime check and load one Nib file if iAds were supported (4.x) and another if not (3.x), but that would seem to create a lot of extra work for you.

It's pretty simple to do this. Apple has an example of this in their iAdSuite sample application. Look in the BasicAdBanner portion of that for the simplest possible implementation.

Within the -createADBannerView method, they even describe what to look for when dealing with older OS versions:

    // --- WARNING ---
    // If you are planning on creating banner views at runtime in order to support iOS targets that don't support the iAd framework
    // then you will need to modify this method to do runtime checks for the symbols provided by the iAd framework
    // and you will need to weaklink iAd.framework in your project's target settings.
    // See the iPad Programming Guide, Creating a Universal Application for more information.
    // http://developer.apple.com/iphone/library/documentation/general/conceptual/iPadProgrammingGuide/Introduction/Introduction.html
    // --- WARNING ---

To be honest, the value of supporting 3.x users on a non-iPad application is dwindling. As an experiment, I added iAds to an update of one of my applications and made it 4.0-only. Out of 50,000 people that have upgraded, only two have complained about it not being compatible with 3.x. I expect 4.2 uptake to be fairly fast among iPad users as well once that update is available.


If you intend to offer the application to users on iOS 3.x, I believe you’ll need to either do this programmatically or provide two nibs.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号