Home > Development, iOS, Xcode > Xcode 4.2 and older iOS devices

Xcode 4.2 and older iOS devices

December 18th, 2011

If you want to build software using the new default templates on Xcode 4.2, you have some work to do for older devices (anything that can’t run iOS 5).

For some unknown reason, the variable $(ARCHS_STANDARD_32_BIT), which used to expand to armv6 armv7 now expands only to armv7.

Furthermore, there is a new entry in the default Info.plist which will prevent Xcode from even uploading the binary to your device.

Finally, there are issues with the compiler’s ‘thumbnail generation’ code ‘Thumb code’ generation in Xcode 4.2. You can disable that compiler option for armv6 builds in Xcode.

I have a 2nd generation iPod Touch that I use daily. It runs iOS 4.2.1, the latest it will ever run. This is essentially the same hardware as an iPhone 3G in terms of capabilities.

I also have a 1st gen Touch, but it’s getting used less and less as I target iOS 4 as the earliest capable version. I’m not going to iOS 5 yet because my main device is still iOS 4.

When I create a new project, I use iOS 5 as the SDK and iOS 4.2 as the deployment target. In theory, this allows me to target all devices that can run iOS 4, which includes my beloved Touch.

To make this work properly, you will want to do three things:

  1. In your Project’s Build Settings, locate the “Architectures” line. It should say $(ARCHS_STANDARD_32_BIT). Edit it to contain two entries: armv6 and armv7.
  2. In your Project’s Info.plist, locate the entry for “Required device capabilities” and delete it.
    If you expand it, you will see that it contains only armv7.
  3. Bonus! Thanks to @jamesthomson, there are issues with clang-llvm 3.0 on armv6 devices.
    In your Project’s Build Settings, locate “Other C flags” and add “-mno-thumb” to the armv6 architecture.

When radar comes back online, I’ll file the bug (which will undoubtedly be marked “Duplicate”)

Categories: Development, iOS, Xcode Tags:
  1. December 20th, 2011 at 19:01 | #1

    Well, my advice when it comes to iOS 4.2 and older devices is much simpler:

    Don’t do it.

    cf: http://wanderingcoder.net/2011/11/16/gcc-dead-young-llvm/

    (also, -mno-thumb has nothing to do with any sort of “thumbnail generation” whatsoever. It makes the compiler emit ARM code instead of emitting Thumb code; see my blog post on the matter: http://wanderingcoder.net/2010/07/19/ought-arm/ ).

  2. December 20th, 2011 at 19:46 | #2

    It sure is great to only support the latest, I agree. I also agree with Matt Gemmell: http://mattgemmell.com/2011/12/05/latest-version/

    However, I am using llvm, and not gcc. I’m also using ARC. This all works with iOS 4.

    That being said, I have this iPod Touch, and I want to write little apps that scratch my own itch. It’s a second-generation Touch, so it is ARMv6, and I wrote this post so I would remember how to do it the next time I have to do it.

    Thanks for the info about -mno-thumb.

  3. December 21st, 2011 at 02:33 | #3

    D’oh! Sorry, I meant “Xcode 4.2 and older devices”, not “iOS 4.2 and older devices”. Silly me. Heck, I still support iPhoneOS 3.2… And I use Clang exclusively these days.

    Well, if it works for you, no problem, especially if it’s for your own use or at least you have such a device that you use daily (honestly, most developers are also gadget freaks and personally use newer devices, and as a result notice the issue only once their app has shipped on the app store). I just argue the ARMv6/Xcode 4.2+ combination is too risky to be worth it (remember: Apple no longer targets ARMv6) and either ARMv6 or Xcode 4.2 has to give.

Comments are closed.