iOS app developed in Xcode 4.5 runs fine on iOS 6 but crashes on iOS 5

2

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:

stack trace image

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

  1. Any idea what might be going on here?
  2. Is it possible to develop an iOS 5 app using Xcode 4.5? I assume that the answer is yes.
  3. How do I see the contents of the registers? I have tried looking a few things from here but haven't been able to see anything useful.
  4. Which registers should I be focusing on?
  5. What is the question that I should be asking that I am not asking?

Solution:

Disable Auto-Layout

ios
xcode
ios5
ios6
xcode4.5
asked on Stack Overflow Oct 20, 2012 by Frank • edited Jun 20, 2020 by Community

3 Answers

6
  1. 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:
    enter image description here
    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.

  2. 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.

  3. 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
}
answered on Stack Overflow Oct 20, 2012 by Sam Spencer • edited Jan 3, 2013 by Sam Spencer
4
  1. You're probably using an iOS 6 API. Maybe you're using Auto-Layout. Check in all of your xib files that you disabled Auto-Layout. See this answer.
  2. It's certainly possible to develop iOS 5 apps with Xcode 4.5. You have to set the deployment target accordingly (which you did) and not use any iOS 6 features or APIs.
  3. & 4: 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.
answered on Stack Overflow Oct 20, 2012 by DrummerB • edited May 23, 2017 by Community
0

I ran into a similar problem building with Xcode 4.5 - it cleared up with xCode 4.5.1

Hope this helps.

answered on Stack Overflow Nov 2, 2012 by jbbenni

User contributions licensed under CC BY-SA 3.0