Use the 3.0 iPhone SDK to deploy to older versions (like 2.2.1)

I’m integrating Pinch Media’s analytics and OpenFeint’s social gaming tools into my latest iPhone app. I just nabbed r64 of the Pinch library and dropped it into my app. When I compiled, I received two odd errors:

“___restore_vfp_d8_d15_regs”, referenced from:
[...]
“___save_vfp_d8_d15_regs”, referenced from:
[...]

The [...] was a big list of objects tied to the r64 library. So, I dropped a note to the folks at Pinch and received this great reply.

- You want to build an app that will work on iPhone OS 2.2 devices.
- You’re switching Base SDK to do so

According to Apple (no link handy, but I heard this all the time at
WWDC last week), you should do the following:

- Set Base SDK (for all configurations) to iPhone Device 3.0
- Set iPhone OS Deployment Target to iPhone OS 2.2 (or whichever you
like)

(You’ll find these settings in the Build tab if you Get Info on your
project (the top item in the Groups & Files pane in Xcode)

The issue is that they’re using a newer compiler in the 3.0 SDK, and
we’re going with their Best Practices (use 3.0 SDK, choose a
lower-version Target if you wish), and there are some features of the
compiler (which generates code that works all the way down to 2.0)
that are only available with the 3.0 release.

I’m sharing it here because it applies to pretty much any app.

** Also, if you are developing with OpenFeint make sure you grab the 6.16 release. This is the first release that will compile properly with the 3.0SDK.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Reddit
  • Slashdot
  • Technorati
  • DZone
  • NewsVine
  • StumbleUpon
  • E-mail this story to a friend!
  • Sphinn

7 Comments

  1. Benny says:

    Hey Jamie, just wanted to drop you a line and say thanks! This is exactly what I was looking for and just wanted to drop you a line :)

  2. Jeff says:

    This does not work when MapKit lib is used. Setting the Base SDK to 3.0 and Deployment to 2.1, then launching on a 2.2.1 device gives this runtime error:

    dyld: Library not loaded: /System/Library/Frameworks/MapKit.framework/MapKit
    Referenced from: /var/mobile/Applications/…/MyApp.app/MyApp
    Reason: image not found

    I’m new at this — maybe I’m doing something wrong. I’m not calling any of the new functions in the code (which never runs, anyway). I also found this similar error report:

    http://openradar.appspot.com/6986707

  3. jamiegrove says:

    Hey, Jeff.

    You’re getting that error because MapKit was added in 3.0. This means it isn’t available as a public framework on the target OS. If you need MapKit, you’ll need to target 3.0 devices only.

    - Jamie

  4. Ryan says:

    Jamie,

    This is the answer I have been looking for. I had trouble finding the CoreLocation Framework, and the MapKit Framework. I set my Base SDK like you said and they both appear after I click on the “+” to add frameworks. I have seen so many forums where the people say “Just click Add Existing Frameworks…. duh”. Now I actually can! I don’t know how I missed that config before but I did. Thank you so much for posting.

  5. You should obviously use AGON instead of OF :)

    Check it out here: http://www.youtube.com/watch?v=bZOhhLXffoo

    More info: http://developer.agon-online.com/

    (I am one of the developers of AGON, so I might be somewhat biased ;) )

    Best regards,
    Morten

  6. Thomas says:

    thank you for sharing this reply
    I’m glad to hear that you don’t have to use ifdefs for a multi-OS app. ;)
    Thomas’ s last blog ..This way, stupid! My ComLuv Profile

  7. Paul Brady says:

    Thank you Jamie!

    Nice to have that explained finally!