iPhone OS backward compatibility, Target and Deployment SDKs and AdWhirl integration

Shyamal Mehta

Since many iPhone and iPod Touch users have not upgraded to the iPhone OS 3.0, it makes a lot of sense to enable backward compatibility on applications. But if you want to leverage the latest 3.0 features, you would have to put some extra effort to ensure full backward compatibility.

And if you are also integrating 3rd party libraries (analytics, ad networks etc.), you would have to ensure those also are backward compatible.

Q: How can I ensure that my application works on all iPhone OS versions from OS 2.0 to the latest 3.x version? And I do need to use some 3.0 features like push notifications or the Map Kit functions.

  1. Choose the Base SDK as iPhone Device 3.0. You can do this by right click on project name->Get Info. Then on the General tab, set the “Base SDK for All Configurations”to “iPhone Device 3.0”.
  2. Choose your deployment to be the lowest version you want to support. You can do this by right click on project name->Get Info. Then on the Biold tab, select “All Configurations” for Configuration so that this change is applied to all you configurations. Then look for the “iPhone OS Deployment Target” property under the “Deployment” section. Set that to the correct iPhone OS version. In my case I set it to “iPhone OS 2.0”.
  3. In your code wherever you use any APIs available only in versions later than your deployment target, use them conditionally after checking if they are available. This can be done for both classes and selectors.

Apple’s documentation describes this in further detail. Here is an image from the documentation that describes how the compatibility works based on the configuration:

When using 3rd party APIs and linking to dylib libraries, there might be further problems if the versions are not compatible. When trying ot integrate AdWhirl, we got an error:

<span class="typ">Dyld</span> <span class="typ">Error</span> <span class="typ">Message</span><span class="pun">:</span><span class="pln">
  </span><span class="typ">Library</span> <span class="kwd">not</span><span class="pln"> loaded</span><span class="pun">:</span> <span class="str">/usr/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libxml2</span><span class="lit">.2</span><span class="pun">.</span><span class="pln">dylib
  </span><span class="typ">Referenced</span> <span class="kwd">from</span><span class="pun">:</span> <span class="str">......</span><span class="pln">
  </span><span class="typ">Reason</span><span class="pun">:</span> <span class="typ">Incompatible</span><span class="pln"> library version</span><span class="pun">:</span><span class="pln"> xxxxx </span><span class="pln">requires version </span><span class="lit">10.0.0</span> <span class="kwd">or</span><span class="pln"> later</span><span class="pun">,</span><span class="pln"> but libxml2</span><span class="lit">.2</span><span class="pun">.</span><span class="pln">dylib provides version </span><span class="lit">9.0.0</span>

This happens because iPhone OS version 2.x  and 3.xuse different versions of the library. The simplest way to fix this is to make the linking for the library weak. This can be done by right click on your application under “Targets” and select Get Info. Then on the General tab, under the linked libraries, locate this library and change the linking type from “Required” to “Weak”

about the author

Shyamal Mehta

Shyamal is an experienced technology professional having expertise on the web and mobile technologies. His strength lies in his ability to successfully and repeatedly deliver projects and products (large and small) for a variety of industries.

  1. htc touch software

    October 12, 2010

    Nice post! Keep it up and I

  2. mens Moncler Online

    March 3, 2011

    a superb blog site article ,We stock Argyle, Bailey, Cardy, Sheepskin, ?- .

  3. wind energy conversion systems by ll freris

    December 22, 2011

    I bought some bulbs that I was told were shallots from a farmer s market in Maine. I planted some there and brought the rest to Arizona and planted them all in the fall. The plant seems to be different they bunch but are larger and flat. As they went to seed, bulb clusters developed on the leaves. I

  4. Network Neutrality Backlash

    April 7, 2012

    You obviously know what you’re writing about. Good job.

  5. Undinstot

    June 11, 2012

    Cheap Ken Griffey Shoes

    I would say the script aids you when you need to control Wp consumer accounts. You could possibly flip users’ details, the fact that includes password, assign roles or developing model another girls. Right after when, one could include these account in order to really obtain WordPress that can would that which you will actually offer.