7

Since Xcode 4.5, we are unable to build for armv6 and thus unable to support devices like iPhone 3G anymore.

Would it be possible to use, say, Xcode 4.3 to generate a properly signed armv6 binary and then use lipo to combine that binary and the Xcode-4.5-generated armv7 binary into a fat one?

How would I go about this? Does anyone know a good tutorial?

Would the resulting fat binary be allowed for submission to the App Store?

tajmahal
  • 1,665
  • 3
  • 16
  • 29
  • I don't think this would be possible, unless you tried to play with Xcode's created archives. – Richard J. Ross III Sep 25 '12 at 01:00
  • 1
    While not exactly the same question as yours, see the answer by Mike to the question [How to support both armv6 and armv7s for release build in xcode 4.5](http://stackoverflow.com/questions/12619124/how-to-support-both-armv6-and-armv7s-for-release-build-in-xcode-4-5). He describes a process to build both armv6 and iOS 6.0 binaries, then combine them in a way that works for applications submitted to the App Store. – Brad Larson Oct 08 '12 at 02:24

2 Answers2

5

The code signature would no longer match after modifying a binary using lipo. So the bundle would need to be re-codesigned afterwards.

Apps built with Xcode 4.4 and even earlier will still run just fine on iOS 6 devices; and there are reports that Apple is still accepting apps built with the iOS 5.1 SDK.

Objective C will allow you to use some of the newer APIs not in the older linked frameworks via calling them thru the Objective C runtime by name. (Of course, the app should check for their availability on the current device first!)

You can even support the new iPhone 5 display from an earlier Xcode and pre-iOS-6 SDK by simply including a 568@2x tall Default image in the app bundle, and setting all your app's window and view sizes and resizing properties properly. UPDATE: Apple is no longer accepting apps built this way when submitted to the iTunes App store.

ADDED: Another potential solution is to split your development into two similar apps. One for iOS 4.3 and up. And one for iOS 4.2.x and lower with not iOS 6 and iPhone 5 support. Two different apps in the app store. However it is unknown whether Apple will allow this.

hotpaw2
  • 70,107
  • 14
  • 90
  • 153
  • Using iOS 6 SDK features while linking to iOS 5.1 SDK doesn't sound like a very solid way of doing things, does it? I'd prefer a solution where I can build armv6 and armv7 versions independently. As for codesigning: is there way to codesign the bundle after creating the fat binary? – tajmahal Sep 25 '12 at 04:52
  • 1
    FYI: Apple will declare your binary "Invalid" if you have the 568@2x default image in a pre-iOS-6 SDK. I am going down the path of having two applications – Brent Priddy Sep 29 '12 at 04:41
  • Is there a way of manually re-codesigning the bundle after modifying it with lipo? – tajmahal Oct 02 '12 at 15:23
  • Just found this in Apple's codesigning guide: "Because each architecture component is signed independently, it is all right to perform universal-binary operations (such as running the lipo command) on signed programs. The result will still be validly signed as long as you make no other changes." Which means it should work, as long as I have already set up the Deployment Target, Architectures, and Valid Architectures properly, right? – tajmahal Oct 02 '12 at 15:29
  • Has anyone tried this approach? Does it work? Will Apple accept it and will the 3G install and run the app? – lschult2 Oct 02 '12 at 17:50
  • I couldn't get it to work. Here's what I did, in case someone wants to keep trying: I set the Deployment Target to 4.2, added armv6 to Architectures and Valid Architectures, and created an archive of an Ad-Hoc build in Xcode 4.5. Then I copied the Xcode project to a Mac running Xcode 4.3. There, I modified the project to include only armv6 in Architectures and Valid Architectures, then created an archive from that. (Signed with the same certificate and profile, of course.) Then I extracted the binary from both archives, renamed them, ran `lipo -create [bin1] [bin2] -output [out]`. – tajmahal Oct 06 '12 at 11:57
  • I put the resulting binary back into the Xcode 4.5-created archive, with the same name as the binary that was in there originally. As long as nothing else in the archive is altered, apart from adding the properly signed armv6 architecture to the binary, the archive doesn't need to be re-signed. (Apple Code Signing Guide: "Because each architecture component is signed independently, it is all right to perform universal-binary operations (such as running the lipo command) on signed programs. The result will still be validly signed as long as you make no other changes.") – tajmahal Oct 06 '12 at 12:00
  • 1
    The resulting archive worked fine on an iPhone 4 running iOS 6.0, so there is indeed nothing wrong with codesigning. But when trying to install on an iPhone 3G running iOS 4.2, I get a "cannot be installed" error. I also tested an armv6-only (Xcode 4.3-created) version of the app on the 3G, which worked just fine. I don't know where the problem lies. Maybe it's the Base SDK, which needs to be kept at 6.0 in order to be able to support iOS 6 features such as the new 4" screen. Maybe it's the DT* entries Xcode puts into the Info.plist when creating the bundle. – tajmahal Oct 06 '12 at 12:05
  • Changing those would require re-signing the bundle, however. If someone wants to try and is successful, please post the results here. Thanks! – tajmahal Oct 06 '12 at 12:05
  • @hotpaw2: So to summarize, it is not possible to support the iPhone 5 and prevent compatibility mode without requiring iOS 6? I had a lucky update going through supporting the iPhone 5 and iOS 4.2.1, but it seems that is no longer possible – Timm Oct 16 '12 at 22:09
0

It appears that someone else figured out how to do it, see this SO question.

I haven't tested it yet myself, though.

Community
  • 1
  • 1
tajmahal
  • 1,665
  • 3
  • 16
  • 29