Xcode 4.5 and iOS 4.2.1 Incompatibility

Xcode 4.5 and iOS 4.2.1 incompatibility

You can do this, but it requires some minor Xcode hacking, and some sacrifices. Depending on what you mean by "support iOS 6", this may or may not be sufficient for you. If you just want your app to run on iOS 6, then this should work. If you also need your app to incorporate new iOS 6 features, then it won't.

    (Note for others who don't have a problem using multiple versions of Xcode: this similar question has answers that do allow you to also use new iOS 6 APIs and directly target armv7s)

See basic instructions on chpwn's blog here (but read the rest of this below, too!)

Basically, you can use Xcode 4.5 to build for iOS 4 and above, but then you can't take advantage of the new iOS 6 only features. So, you're really building for iOS 4 and 5, and assuming that the app will run fine on iOS 6 (which should be true, but you'll need to test this yourself).

You'll need to copy the iOS 5 SDK folder

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.*.sdk

from an old Xcode installation (which you'll need to keep around briefly, or reinstall to a non-standard location). You'll then set the Deploy Target in your Build Settings to iOS 4.0 (or whatever minimum OS you want). You may need to open the project.pbxproj file in a text editor to set this manually:

IPHONEOS_DEPLOYMENT_TARGET = 4.0;

You'll also need to set the Architectures to armv6 and armv7. You cannot directly also target armv7s. But, that doesn't mean your app won't run on iPhone 5. armv7 executables should run on iPhone 5, simply without any optimizations added in armv7s. It's just that compatibility doesn't work in the other direction (e.g. armv7 executables don't run on an armv6 iPhone 3G).

Sample Image

There's also a step that might be necessary, that's not mentioned in chpwn's blog. You may get these warnings (which really are errors, because Xcode won't generate your executable properly):

warning: no rule to process file '$(PROJECT_DIR)/main.m' of type sourcecode.c.objc for architecture armv6

In order to fix this, you'll need to setup a custom Build Rule for your target that tells Xcode to use LLVM GCC 4.2 to generate armv6 code. Define the rule for files matching the pattern *.[mc]:

Sample Image

This will be a different compiler than the Xcode default, and you may need to adjust some of the syntax in your Objective-C code. Even though many people wanting to do this probably wrote their apps before ARC, it is important to note that LLVM gcc 4.2 does not support ARC.

Finally, you probably will still see warnings from Xcode about iOS deploy targets less than 4.3, and armv6 not being supported. Those, I found, were not problems, and could be ignored:

Sample Image

Running lipo -info on my app executable after this shows the desired result:

lipo -info MyAppName
Architectures in the fat file: MyAppName are: armv6 armv7

how to change iOS deployment target to 4.2 on xcode 4.5.1?

You can't. Xcode 4.5.x only supports iOS 4.3 and later. Xcode 4.5.x no longer supports armv6 devices. armv6 devices only support up to iOS 4.2.1.

Apple wants everyone to move forward. If you want to support iOS 6, you need to drop 4.2 and earlier. This means no 1st or 2nd gen iPod touch, no iPhone, or iPhone 3G.

How to change deployment target from iOS 5.1 to 4.2 in Xcode 4.4

It's a known bug. XCode 4.4 doesn't let you target armv6 architecture. You'll have to downgrade to Xcode 4.3.3 to do this (learned it the hard way :-/). You'll have to download 4.3.3 from the Apple dev website.

Also, make sure not to run both 4.4 and 4.3.3 at once. My mac was semi frozen for an hour until I managed to force kill these two processes.

Update: This bug has been fixed in the newer versions of the XCode.

Support both armv6 and iOS 6 in an App Store app?

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

I haven't tested it yet myself, though.

How to use .a's built in lower version with Xcode 4.5

I think this is an issue with using a library which was build supporting armv6, which has been dropped in Xcode 4.5

The best long term solution is to ask the developer who created these libraries to rebuild to support the latest Xcode, but in the meantime you can try following these instructions

Build for armv6 architecture (target iOS 3.1.3) with iOS 6 SDK and Xcode 4.5?

With Xcode 4.5 (ie iOS 6 SDK) the lowest version you can build for is iOS 4.3. I guess it is time for your 3.1.3 customers to upgrade.



Related Topics



Leave a reply



Submit