I have an iOS application that was developed using Xcode Version 4.5.1. My iOS deployment target is set to 5.0 since I would like the app to run on iOS 5.0, 5.1 and 6.0.
When I run the app on an iOS 6 device (or simulator) everything works fine. When I run the app on an iOS 5 device (or simulator) the application crashes in UIApplicationMain. I can step al of the way through application:didFinishLaunchingWithOptions: and it appears to be executing successfully. Here is the stack trace:
Here are the registers if it helps:
(lldb) register read
General Purpose Registers:
eax = 0x06e5f590
ebx = 0x01226f9c "class"
ecx = 0x0733fb8c
edx = 0x0733fb90
edi = 0x0011d814 (void *)0x0011d800: TRAppDelegate
esi = 0xbffff310
ebp = 0xbffff2e8
esp = 0xbffff2a0
eflags = 0x00000286
eip = 0x00002b3d Messenger`main + 141 at main.m:16
6 registers were unavailable.
(lldb)
backtrace:
(lldb) bt
* thread #1: tid = 0x1c03, 0x01211caa libobjc.A.dylib`objc_exception_throw, stop reason = breakpoint 1.3 2.3
frame #0: 0x01211caa libobjc.A.dylib`objc_exception_throw
frame #1: 0x015cda48 CoreFoundation`+[NSException raise:format:arguments:] + 136
frame #2: 0x015cd9b9 CoreFoundation`+[NSException raise:format:] + 57
frame #3: 0x006954a3 UIKit`UINibDecoderDecodeObjectForValue + 281
frame #4: 0x0069567b UIKit`UINibDecoderDecodeObjectForValue + 753
frame #5: 0x00695383 UIKit`-[UINibDecoder decodeObjectForKey:] + 117
frame #6: 0x0059516d UIKit`-[UINib instantiateWithOwner:options:] + 921
frame #7: 0x0043b1fc UIKit`-[UIViewController _loadViewFromNibNamed:bundle:] + 286
frame #8: 0x0043b779 UIKit`-[UIViewController loadView] + 302
frame #9: 0x0043b99b UIKit`-[UIViewController view] + 53
frame #10: 0x0039a401 UIKit`-[UIWindow addRootViewControllerViewIfPossible] + 45
frame #11: 0x0039a670 UIKit`-[UIWindow _setHidden:forced:] + 280
frame #12: 0x0039a836 UIKit`-[UIWindow _orderFrontWithoutMakingKey] + 49
frame #13: 0x003a172a UIKit`-[UIWindow makeKeyAndVisible] + 35
frame #14: 0x00372596 UIKit`-[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1820
frame #15: 0x00373274 UIKit`-[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 524
frame #16: 0x00382183 UIKit`-[UIApplication handleEvent:withNewEvent:] + 1027
frame #17: 0x00382c38 UIKit`-[UIApplication sendEvent:] + 68
frame #18: 0x00376634 UIKit`_UIApplicationHandleEvent + 8196
frame #19: 0x02314ef5 GraphicsServices`PurpleEventCallback + 1274
frame #20: 0x015f9195 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
frame #21: 0x0155dff2 CoreFoundation`__CFRunLoopDoSource1 + 146
frame #22: 0x0155c8da CoreFoundation`__CFRunLoopRun + 2218
frame #23: 0x0155bd84 CoreFoundation`CFRunLoopRunSpecific + 212
frame #24: 0x0155bc9b CoreFoundation`CFRunLoopRunInMode + 123
frame #25: 0x00372c65 UIKit`-[UIApplication _run] + 576
frame #26: 0x00374626 UIKit`UIApplicationMain + 1163
frame #27: 0x00002b3d Messenger`main + 141 at main.m:16
(lldb)
Questions
Disable Auto-Layout
It's possible you're using features only available in iOS 6 such as AutoLayout. Open your interface files and make sure AutoLayout is unchecked:
This AutoLayout toggle can be found in the utilities inspector (pane on the right side of Xcode) and then under the first tab of the Utilities Inspector (the File Inspector). You can also change the Document Versioning Deployment setting to the lowest iOS version your app supports. After doing so, Xcode will show warnings for features in your interface that are deprecated or may not be supported on some iOS versions.
Yes, of course you can develop apps for earlier versions of iOS with Xcode 4.5. Just make sure that your deployment target is set correctly in your project settings.
DrummerB's Suggestion for 3 & 4 should work well:
I don't think that's going to help. Maybe you could try running bt in the debug console when your app crashes to get a trace.
Also, to improve upon DrummerB's answer, it is okay to use iOS 6 classes / APIs but you must check for their availability before using them:
if ([UIClassName class] != nil) {
//UIClassName is available, you can now set it up
} else {
//UIClassName is not available, use a different class or prompt the user
}
bt
in the debug console when your app crashes to get a trace.I ran into a similar problem building with Xcode 4.5 - it cleared up with xCode 4.5.1
Hope this helps.
User contributions licensed under CC BY-SA 3.0