Does Xcode 4.2 support compiling projects for iOS 3.1.3? I tried compiling a project that I'm currently working on, and I keep getting crashes every time I try running the application on an iPhone 3G with iOS 3.1.3. I know that the OS I'm running on is outdated already, but the client required that the application should run on iOS 3.1.3. Any ideas how will I solve this problem?
2 Answers
In Build Settings changes following settings:
- Base SDK -> Lastest iOS (iOS 5.0)
- iOS Deployment Target -> iOS 3.1
- Architectures -> choose other... and manual add "armv6"
- Valid Architectures -> remove "armv7", just leave "armv6"
In *AppDelegate.m
- (bool)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease];
// Override point for customization after application launch.
self.viewController = [[[MyHudDemoViewController alloc] initWithNibName:@"MyHudDemoViewController" bundle:nil] autorelease];
// NOTE THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// iOS 3.1 don't support the following statement.
//self.window.rootViewController = self.viewController;
[self.window addSubview:self.viewController.view];
[self.window makeKeyAndVisible];
return YES;
}
Uh....SORRY... forgot one...
- Check your project's Info.plist, if it has the "Required device capabilities" item, then change the item from "armv7" to "armv6".

- 11
- 2
-
Thanks ... anyway im getting this error. warning: all apps should include an armv7 architecture (current ARCHS = "armv6"). iPhone/iPod Touch: application executable is missing a required architecture. At least one of the following architecture(s) must be present: armv7 (-19033) – Avenson Robles Navalta Nov 30 '11 at 08:15
-
Sorry, I can not help you about this warning(or error?) if you want to create a new project for iOS 3.1.3 with Xcode 4.2, you can do like I said. – Snowfox Nov 30 '11 at 12:22
-
Hi, I have an app working ok on Iphone 3GS or 4. Now, I'm trying to making work on Iphone 3G, but I can't. I have some problems and I want to check if I'm configuring ok the project for Iphone 3 to be sure that my problems are not related to this configuration. I checked my AppDelegate.m and don't have the code showed for you. Is mandatory to add that code or only I need to changed if exist? Thanks and sorry for my poor english – Mark Comix Dec 14 '11 at 13:13
Here are a whole bunch of things I had to do to make XCode 4 compile for iOS 3.1 AND debug on a 3G iPhone:
Downgrade to XCode 4.3.3.
Xcode 4.5.2 would simply refuse to connect to an iPhone 3G for debugging. The 4.3.3 version happily coexists alongside the 4.5.2, they can even share the same project file, although leaving the armv7s in the architecture settings will generate innocuous warnings in 4.3.3. See below.
Change the project settings
Architecture -> go to "others", remove the line, put armv6 armv7
(you can also add armv7s in the line above for compiling the same project with 4.5.2, but it will generate warnings under 4.3.3)
Valid architecture -> armv6 armv7 armv7s Deployment target -> change to 3.1
In the plist file, in "Required device capabilies", remove armv7.
Change the Target settings (click target on the left pane)
deployment target to 3.1
Edit your Scheme to change the debugger
In the Run section, debug, change debugger to GDB (instead of LLDB)
In the Test section, debug, change debugger to GDB (instead of LLDB)
Change the auto-generated code that will crash an iOS 3.1 app
In your AppDelegate "didFinishLaunchingWithOptions", instead of this line
self.window.rootViewController = self.viewController;
Put this code
if ([self.window respondsToSelector:@selector(setRootViewController:)]) self.window.rootViewController = self.viewController; else [self.window addSubview:self.viewController.view];
And then you should be able to run and debug on a 3G iPhone.

- 501
- 6
- 11