How to make an iAd integrated iPhone app working on previous versions of iPhone OS?
As title described, I integrated iAd i开发者_C百科nto my iPhone apps. Everything worked fine in the iPhone simulator (iOS4). However, when I try to install it on my iPhone(version 3.1.3), I got an error:
dyld: Library not loaded: /System/Library/Frameworks/iAd.framework/iAd
Referenced from: /var/mobile/Applications/...
Reason: image not found
I already properly set the deployment target to v3.0, and base SDK to 4.0. When I comment out all the iAd related code, the apps installs with no problem.
There must be a way to do this, because I downloaded the apps "showtimes" and "Yellow Pages", which use iAd. Both apps run very well on my 3.1.3 phone, and I can see the iAd as well.
Does anybody know how to do this?
To get past the loader error, double-click your target in Xcode and change the link type of the iAds.framework to "Weak" instead of "Required". You'll probably have to do some conditional coding to support other ad networks as well, because iAds are not supported on pre-4.0 systems.
In xCode 4 select "Targets"-"Build Phases"- "Link Binary With Libraries". Change the link type of the iAd.framework to "Optional" instead of "Required".
You can integrate AdWhirl into your app instead, which can deliver you iAds among others. More usefully, it will provide you with adverts you can display in iOS3.*.
精彩评论