Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS crash at startup without Xcode attached

I'm having a strange issue with an iOS app of mine. When it is run via Xcode (Build & Run), all works well. The app launches and everything works as expected.

However, if I try to open the app by tapping its icon as the user would (via Springboard), the app crashes immediately with the crashlog below. It seems to point to some kind of an image-releated issue, but I don't understand how it doesn't occur when debugging using Xcode.

Can anyone shed some light?

Date/Time:       2012-06-15 16:13:29.035 +0100
OS Version:      iPhone OS 5.1.1 (9B206)
Report Version:  104

Exception Type:  EXC_CRASH (SIGKILL)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   dyld                            0x2fe76464 strcmp + 0
1   dyld                            0x2fe6a6e2 ImageLoaderMachO::parseLoadCmds() + 54
2   dyld                            0x2fe72058 ImageLoaderMachOCompressed::instantiateFromFile(char const*, int, unsigned char const*, unsigned long long, unsigned long long, stat const&, unsigned int, unsigned int, linkedit_data_command const*, ImageLoader::LinkContext const&) + 296
3   dyld                            0x2fe6b23a ImageLoaderMachO::instantiateFromFile(char const*, int, unsigned char const*, unsigned long long, unsigned long long, stat const&, ImageLoader::LinkContext const&) + 302
4   dyld                            0x2fe622f6 _ZN4dyldL10loadPhase6EiRK4statPKcRKNS_11LoadContextE + 478
5   dyld                            0x2fe6255e _ZN4dyldL14loadPhase5statEPKcRKNS_11LoadContextEP4statPiPbPSt6vectorIS1_SaIS1_EE + 386
6   dyld                            0x2fe62716 _ZN4dyldL10loadPhase5EPKcS1_RKNS_11LoadContextEPSt6vectorIS1_SaIS1_EE + 278
7   dyld                            0x2fe628fe _ZN4dyldL10loadPhase4EPKcS1_RKNS_11LoadContextEPSt6vectorIS1_SaIS1_EE + 218
8   dyld                            0x2fe630dc _ZN4dyldL10loadPhase3EPKcS1_RKNS_11LoadContextEPSt6vectorIS1_SaIS1_EE + 1144
9   dyld                            0x2fe63240 _ZN4dyldL10loadPhase1EPKcS1_RKNS_11LoadContextEPSt6vectorIS1_SaIS1_EE + 108
10  dyld                            0x2fe63392 _ZN4dyldL10loadPhase0EPKcS1_RKNS_11LoadContextEPSt6vectorIS1_SaIS1_EE + 262
11  dyld                            0x2fe634c4 dyld::load(char const*, dyld::LoadContext const&) + 224
12  dyld                            0x2fe650f2 dlopen + 742
13  libdyld.dylib                   0x360d55a2 dlopen + 42
14  CoreFoundation                  0x37256092 _CFBundleDlfcnLoadBundle + 106
15  CoreFoundation                  0x37255f36 _CFBundleLoadExecutableAndReturnError + 370
16  Foundation                      0x32d7bf40 -[NSBundle loadAndReturnError:] + 904
17  SomeApp                         0x000bcb3a 0x5e000 + 387898
18  SomeApp                         0x000c56d0 0x5e000 + 423632
19  SomeApp                         0x000c539a 0x5e000 + 422810
20  SomeApp                         0x00062f86 0x5e000 + 20358
21  UIKit                           0x30438c84 -[UIViewController view] + 160
22  SomeApp                         0x000622a6 0x5e000 + 17062
23  SomeApp                         0x0005fcc4 0x5e000 + 7364
24  UIKit                           0x30437ca4 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1176
25  UIKit                           0x304317d6 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 402
26  UIKit                           0x303ffabc -[UIApplication handleEvent:withNewEvent:] + 1004
27  UIKit                           0x303ff560 -[UIApplication sendEvent:] + 48
28  UIKit                           0x303fef34 _UIApplicationHandleEvent + 5820
29  GraphicsServices                0x3741b224 PurpleEventCallback + 876
30  CoreFoundation                  0x3729f51c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
31  CoreFoundation                  0x3729f4be __CFRunLoopDoSource1 + 134
32  CoreFoundation                  0x3729e30c __CFRunLoopRun + 1364
33  CoreFoundation                  0x3722149e CFRunLoopRunSpecific + 294
34  CoreFoundation                  0x37221366 CFRunLoopRunInMode + 98
35  UIKit                           0x30430864 -[UIApplication _run] + 544
36  UIKit                           0x3042dcce UIApplicationMain + 1074
37  SomeApp                         0x0005fb00 0x5e000 + 6912
38  SomeApp                         0x0005fac0 0x5e000 + 6848

Edit: Talked this through with the Apple Developer Team. The issue is that I used a self-made plugin in my app that wasn't codesigned (even though I told Xcode to do so). However, Xcode 4.3.3 has a bug that breaks codesigning for bundles, so we'll see how this works out soon.

like image 237
Pripyat Avatar asked Jun 15 '12 15:06

Pripyat


2 Answers

It looks like this is still a problem as of Xcode 4.5. As a workaround, it seems that you can force the build to sign the bundle.

Adding the following as a final "Run Script" build phase for the bundle fixed it for me:

codesign -fs "iPhone Developer" ${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}

like image 79
Chris Devereux Avatar answered Oct 02 '22 17:10

Chris Devereux


Your application may be taking too long to launch. It is given unlimited time when launching from Xcode, but is not afforded this luxury when launching from SpringBoard.

Take a look at this for reference: https://developer.apple.com/library/ios/#qa/qa2009/qa1592.html

edit: Oh, how did I get here... this is two weeks old.

like image 33
MikeS Avatar answered Oct 02 '22 16:10

MikeS