Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make an iAd integrated iPhone app working on previous versions of iPhone OS?

As title described, I integrated iAd into 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?

like image 523
Yuchen Wang Avatar asked Jun 25 '10 05:06

Yuchen Wang


2 Answers

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.

like image 120
warrenm Avatar answered Sep 28 '22 15:09

warrenm


In xCode 4 select "Targets"-"Build Phases"- "Link Binary With Libraries". Change the link type of the iAd.framework to "Optional" instead of "Required".

like image 31
OrdoDei Avatar answered Sep 28 '22 16:09

OrdoDei