iOS crash at startup without Xcode attached - iphone

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.

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}

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.

Related

App hangs when video export finishes on iOS 16 (AVFoundation)

The issue started happening randomly after iOS 16 update. For video exporting AVFoundation's AVAssetExportSession is used. The issue happens only when AVVideoComposition's animationTool property is applied. The ui freezes when the export process finishes. Main thread's call stack is attached below.
Thread 0 - com.apple.main-thread - (TH_STATE_WAITING)
0 libsystem_kernel.dylib +0x13004 _mach_msg2_internal
1 libsystem_kernel.dylib +0x13244 _mach_msg_overwrite
2 libsystem_kernel.dylib +0x1088 _mach_msg
3 QuartzCore +0x8a6ac CA::Render::Message::send_message()
4 QuartzCore +0x2612a8 CA::Render::Encoder::send_message(unsigned int, unsigned int, unsigned int*, unsigned long)
5 QuartzCore +0x31168 CA::Context::commit_transaction(CA::Transaction*, double, double*)
6 QuartzCore +0x663c0 CA::Transaction::commit()
7 UIKitCore +0x504fcc __UIApplicationFlushCATransaction
8 UIKitCore +0x651674 __UIUpdateSequenceRun
9 UIKitCore +0xc90900 _schedulerStepScheduledMainSection
10 UIKitCore +0xc8facc _runloopSourceCallback
11 CoreFoundation +0xd6228 ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
12 CoreFoundation +0xe2610 ___CFRunLoopDoSource0
13 CoreFoundation +0x66578 ___CFRunLoopDoSources0
14 CoreFoundation +0x7beb4 ___CFRunLoopRun
15 CoreFoundation +0x811e0 _CFRunLoopRunSpecific
16 GraphicsServices +0x1364 _GSEventRunModal
17 UIKitCore +0x3a2d84 -[UIApplication _run]
18 UIKitCore +0x3a29e8 _UIApplicationMain
19 PicsArt +0x4998b0 main (main.m:29:16)
20 dyld +0x15944 start
I tried to call AVAssetExportSession's exportAsynchronously and cancelExport functions on background queue, as a result the number of crashes decreased, but big number of users still get this app hang. I expect to find some workaround solution for this.

iOS App crashes in Thread 0

One of our users confronted us with the problem, that the App crashes directly after the app start. Now we only got two Crash Reports, but couldn't reproduce the Crash on any of our devices. The Build is an Enterprise Distribution Build.
The Device is an iPhone 4, with iOS 6.
Any idea would be much appreciated.
Date/Time: 2012-10-30 17:41:11.762 +0100
OS Version: iOS 6.0 (10A403)
Report Version: 104
Exception Type: EXC_CRASH (SIGTRAP)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_c.dylib 0x38edad8e memmove$VARIANT$CortexA8 + 654
1 QuartzCore 0x3401c81c CA::Render::Encoder::encode_bytes(void const*, unsigned long) + 24
2 QuartzCore 0x3401d494 CA::Render::Layer::Ext::encode(CA::Render::Encoder*) const + 152
3 QuartzCore 0x3401c706 CA::Render::encode_set_object(CA::Render::Encoder*, unsigned long, unsigned int, CA::Render::Object*, unsigned int) + 42
4 QuartzCore 0x3401b3e2 CA::Context::commit_layer(CA::Layer*, unsigned int, unsigned int, void*) + 114
5 QuartzCore 0x34011076 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 310
6 QuartzCore 0x3401101c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 220
7 QuartzCore 0x3401101c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 220
8 QuartzCore 0x3401052c CA::Context::commit_transaction(CA::Transaction*) + 1024
9 QuartzCore 0x34010024 CA::Transaction::commit() + 312
10 QuartzCore 0x3400fe84 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 56
11 CoreFoundation 0x34e326ca __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18
12 CoreFoundation 0x34e309bc __CFRunLoopDoObservers + 272
13 CoreFoundation 0x34e30d12 __CFRunLoopRun + 738
14 CoreFoundation 0x34da3eb8 CFRunLoopRunSpecific + 352
15 CoreFoundation 0x34da3d44 CFRunLoopRunInMode + 100
16 GraphicsServices 0x35b0c2e6 GSEventRunModal + 70
17 UIKit 0x379e92fc UIApplicationMain + 1116
18 MyApp 0x000ceb90 main (main.m:16)
19 MyApp 0x000ceb2c start + 36
Here's the second one:
Date/Time: 2012-10-29 15:54:48.926 +0100
OS Version: iOS 6.0 (10A403)
Report Version: 104
Exception Type: EXC_CRASH (SIGTRAP)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x33b1beb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x33b1c048 mach_msg + 36
2 CoreFoundation 0x34e32040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x34e30d5a __CFRunLoopRun + 810
4 CoreFoundation 0x34da3eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x34da3d44 CFRunLoopRunInMode + 100
6 GraphicsServices 0x35b0c2e6 GSEventRunModal + 70
7 UIKit 0x379e92fc UIApplicationMain + 1116
8 MyApp 0x00024b90 main (main.m:16)
9 MyApp 0x00024b2c start + 36
The first one I would suspect that you're animating things while they're being put onto the screen (since it happens during launch). Perhaps something UI-related you're doing in your application delegate, or otherwise doing from a view controller that isn't on the screen yet. That said, the Core Animation calls may be a red herring (see below).
The second one is unlikely the actual crash point. iOS cannot always determine which thread actually crashed, and sometimes will blame the wrong one (and most often thread 0 will be incorrectly blamed). Crashing in a _trap function is really unlikely. The thread is generally suspended at this point. I would study the other threads and see if one of them was doing something suspicious. If you find it elsewhere, then this could also be the cause of the first crash.

iPhone crash log - what is the reason?

I don't have much information when did it happened, because it didn't happened on my watch.
Anyone understand what was the reason?
Crash Log:
OS Version: iPhone OS 5.0 (9A334)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x80624913
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x37c38fbc objc_msgSend + 16
1 UIKit 0x32bc8cec -[UIScrollView(UIScrollViewInternal) _scrollViewAnimationEnded] + 128
2 UIKit 0x0061d7ee -[UIScrollViewAccessibility(SafeCategory) _scrollViewAnimationEnded] + 358
3 CoreFoundation 0x309f8224 -[NSObject performSelector:withObject:] + 36
4 UIKit 0x32b84c2a -[UIAnimator stopAnimation:] + 606
5 UIKit 0x32b845d4 -[UIAnimator(Static) _advance:withTimestamp:] + 260
6 UIKit 0x32b844c6 -[UIAnimator(Static) _LCDHeartbeatCallback:] + 46
7 QuartzCore 0x3219a41c CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) + 160
8 QuartzCore 0x3219a372 CA::Display::IOMFBDisplayLink::callback(__IOMobileFramebuffer*, unsigned long long, unsigned long long, unsigned long long, void*) + 54
9 IOMobileFramebuffer 0x3577ff8c IOMobileFramebufferVsyncNotifyFunc + 76
10 IOKit 0x31d2d88a IODispatchCalloutFromCFMessage + 182
11 CoreFoundation 0x30a62f3c __CFMachPortPerform + 356
12 CoreFoundation 0x30a6d54c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
13 CoreFoundation 0x30a6d4ee __CFRunLoopDoSource1 + 134
14 CoreFoundation 0x30a6c33c __CFRunLoopRun + 1364
15 CoreFoundation 0x309ef4d6 CFRunLoopRunSpecific + 294
16 CoreFoundation 0x309ef39e CFRunLoopRunInMode + 98
17 GraphicsServices 0x3361dfe6 GSEventRunModal + 150
18 UIKit 0x32a6173c UIApplicationMain + 1084
19 MyApp 0x00002304 0x1000 + 4868
20 MyApp 0x00002298 0x1000 + 4760
Looks like a segmentation fault. It seems like (just by observing the trace) there's some memory issue going on when the UIScrollView finishes a scroll animation. Have you tried enabling NSZombies or putting a breakpoint that catches any kind of exception? I know you said it didn't happen on your watch, but if you could get a brief description of where it happened, maybe you can attempt to replicate it while debugging it in Xcode.

iOS app crashing in Core Location callback machinery

I have problems analyzing my crashlog. The iPhone crashes sometimes, when I click on the app icon to start the app. The app is already "running" in background, but it's not active. This is the symbolized crash log:
Thread 0 Crashed:
0 libobjc.A.dylib 0x33479470 objc_msgSend + 28
1 CoreLocation 0x3436f68e -[CLLocationManager onClientEvent:supportInfo:] + 98
2 CoreLocation 0x3436f804 OnClientEvent + 16
3 CoreLocation 0x3436b522 CLClientInvokeCallback(__CLClient*, CLClientEvent, __CFDictionary const*) + 42
4 CoreLocation 0x3436cf74 CLClientHandleDaemonDataRegistration(__CLClient*, CLDaemonCommToClientRegistration const*, __CFDictionary const*) + 668
5 CoreLocation 0x3436d4c8 CLClientHandleDaemonData(__CFMessagePort*, long, __CFData const*, void*) + 212
6 CoreFoundation 0x33a813fe __CFMessagePortPerform + 242
7 CoreFoundation 0x33a556f8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20
8 CoreFoundation 0x33a556bc __CFRunLoopDoSource1 + 160
9 CoreFoundation 0x33a47f76 __CFRunLoopRun + 514
10 CoreFoundation 0x33a47c80 CFRunLoopRunSpecific + 224
11 CoreFoundation 0x33a47b88 CFRunLoopRunInMode + 52
12 GraphicsServices 0x33b0e4a4 GSEventRunModal + 108
13 GraphicsServices 0x33b0e550 GSEventRun + 56
14 UIKit 0x32099322 -[UIApplication _run] + 406
15 UIKit 0x32096e8c UIApplicationMain + 664
16 Norddeich 0x00002764 main (main.m:14)
17 Norddeich 0x00002718 start + 32
As far as i understand the stack trace, the error occurred in the main.m. Line 14 is part of the default code:
int retVal = UIApplicationMain(argc, argv, nil, nil);
Please give me a hint, how to find the error.
Thank you in advance!
Do you set it's delegate to nil before returning from controller (or at least in controller's dealloc)? I suspect CLLocationManager is trying to send a message to delegate which is deallocated already - that's why it crashes at obj_msgSend.
I had this same problem testing my app on 4.3, but not in 5.0. The issue was that I was trying to dealloc the CLLocationManager inside one of the delegate methods. It works fine in 5.0, but crashes a iPhone 3GS running 4.3 every time.
In the end I made the CLLocationManager object a property, then in the delegate method set the delegate to nil and dispatched a block to the main thread to release the object.

iPhone: App crash in MapView after 20 min

I am working on an app that tracks a users location. After about 20 minutes it seems that the app always crashes, and I am not sure why. Device logs show:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x069f6000
Crashed Thread: 0
Thread 0 Crashed:
0 Ride 0x00012e00 -[Route addCoordinate:] (Route.m:92)
1 Ride 0x0000877a -[MyRidesMapViewController locationManager:didUpdateToLocation:fromLocation:] (MyRidesMapViewController.m:528)
2 CoreLocation 0x0000931c -[CLLocationManager onClientEventLocation:] + 584
3 CoreLocation 0x00007552 -[CLLocationManager onClientEvent:supportInfo:] + 98
4 CoreLocation 0x000076a0 OnClientEvent + 16
5 CoreLocation 0x00002ade CLClientInvokeCallback(__CLClient*, CLClientEvent, __CFDictionary const*) + 42
6 CoreLocation 0x0000512c CLClientHandleDaemonDataLocation(__CLClient*, CLClientLocation const*, __CFDictionary const*) + 204
7 CoreLocation 0x0000528a CLClientHandleDaemonData(__CFMessagePort*, long, __CFData const*, void*) + 298
8 CoreFoundation 0x0006936a __CFMessagePortPerform + 242
9 CoreFoundation 0x00071aa4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20
10 CoreFoundation 0x00073848 __CFRunLoopDoSource1 + 160
11 CoreFoundation 0x00074626 __CFRunLoopRun + 514
12 CoreFoundation 0x0001d8e4 CFRunLoopRunSpecific + 224
13 CoreFoundation 0x0001d7ec CFRunLoopRunInMode + 52
14 GraphicsServices 0x000036e8 GSEventRunModal + 108
15 GraphicsServices 0x00003794 GSEventRun + 56
16 UIKit 0x000062a0 -[UIApplication _run] + 396
17 UIKit 0x00004e10 UIApplicationMain + 664
18 Ride 0x00002a20 main (main.m:14)
19 Ride 0x000029d4 start + 32
Looks like I am trying to release something that has already been released, but what?! I have NSZombie enabled, and it does not seem to help.
It used to work, and I recently updated my class to use self. for anything that I synthesized, could this be the issue?
EDIT: I updated the error. It seems to be listing the line numbers for each line, but they do not seem to be helping to find the issue.
Do you have NSZombie enabled while you're running on the device? If so chances are you are running out of memory. As you know, NSZombie keeps released objects around so you can detect a double release.
Chances are you do have some memory issues though. Does the static analyzer show you anything? (shift-command-A).
Setting the location manager delegate to nil AND THEN releasing it fixed the crash for me.