Since i received comments of crashes but the app never crashes for me, I now use critterism to hunt down crashes.
I received one report that pointed to me to an error by me. It was easy, since the method name was given and i
could look in my code what might crash. So far, so good.
But i also have the following two that puzzle me.
To me it looks like the app crashes in some internal apple library.( Most likely due to me feeding it some broken stuff...)
There is no call from my code in the crash, so where do start looking?
Does anyone understand these crashes?
Any idea how i can catch these and maybe get some more crash info?
No.1:
0 CoreFoundation 0x3585f88f __exceptionPreprocess + 162
1 libobjc.A.dylib 0x37c06259 objc_exception_throw + 32
2 CoreFoundation 0x35862a9b -[NSObject doesNotRecognizeSelector:] + 174
3 CoreFoundation 0x35861915 ___forwarding___ + 300
4 CoreFoundation 0x357bc650 _CF_forwarding_prep_0 + 48
5 UIKit 0x332f3efb -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 546
6 UIKit 0x332f2f39 -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 916
7 UIKit 0x332f2763 -[UITableView layoutSubviews] + 206
8 UIKit 0x33296f37 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 182
9 CoreFoundation 0x357be1fb -[NSObject performSelector:withObject:] + 42
10 QuartzCore 0x3268eaa5 -[CALayer layoutSublayers] + 216
11 QuartzCore 0x3268e6bd _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 216
12 QuartzCore 0x32692843 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 226
13 QuartzCore 0x3269257f _ZN2CA11Transaction6commitEv + 314
14 QuartzCore 0x326ba911 _ZN2CA11Transaction5flushEv + 44
15 QuartzCore 0x326ba8e3 +[CATransaction flush] + 34
16 UIKit 0x332a1fb1 _afterCACommitHandler + 52
17 CoreFoundation 0x35833b1b __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18
18 CoreFoundation 0x35831d57 __CFRunLoopDoObservers + 258
19 CoreFoundation 0x358320b1 __CFRunLoopRun + 760
20 CoreFoundation 0x357b54a5 CFRunLoopRunSpecific + 300
21 CoreFoundation 0x357b536d CFRunLoopRunInMode + 104
22 GraphicsServices 0x37451439 GSEventRunModal + 136
23 UIKit 0x332c1cd5 UIApplicationMain + 1080
24 Wohnungssuche 0x000d5218 start + 40
No. 2:
Thread: Unknown Name (Crashed)
0 libobjc.A.dylib 0x35beb5d0 objc_msgSend + 16 + 15
1 UIKit 0x39fb0541 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 409 + 408
2 UIKit 0x39f95361 -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1317 + 1316
3 UIKit 0x39fac7ff -[UITableView layoutSubviews] + 207 + 206
4 UIKit 0x39f68897 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 259 + 258
5 QuartzCore 0x34ab74eb -[CALayer layoutSublayers] + 215 + 214
6 QuartzCore 0x34ab708d _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 461 + 460
7 QuartzCore 0x34ab7fb1 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 17 + 16
8 QuartzCore 0x34ab799b _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 239 + 238
9 QuartzCore 0x34ab77ad _ZN2CA11Transaction6commitEv + 317 + 316
10 QuartzCore 0x34aee7df _ZN2CA7Display11DisplayLink8dispatchEyy + 255 + 254
11 QuartzCore 0x34aee6d9 _ZN2CA7Display16IOMFBDisplayLink8callbackEP21__IOMobileFramebufferyyyPv + 65 + 64
12 IOMobileFramebuffer 0x375f0fd7 IOMobileFramebufferVsyncNotifyFunc + 155 + 154
13 IOKit 0x3282a5ad IODispatchCalloutFromCFMessage + 193 + 192
14 CoreFoundation 0x3918288b __CFMachPortPerform + 119 + 118
15 CoreFoundation 0x3918d3e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 35 + 34
16 CoreFoundation 0x3918d38b __CFRunLoopDoSource1 + 139 + 138
17 CoreFoundation 0x3918c20f __CFRunLoopRun + 1383 + 1382
18 CoreFoundation 0x390ff23d CFRunLoopRunSpecific + 357 + 356
19 CoreFoundation 0x390ff0c9 CFRunLoopRunInMode + 105 + 104
20 GraphicsServices 0x3344933b GSEventRunModal + 75 + 74
21 UIKit 0x39fb9291 UIApplicationMain + 1121 + 1120
Thanks for your help!
The crash point in both cases is the same:
UIKit 0x39fb0541 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 409 + 408
In the first case, the table view was trying to call a method on an instance that does not implement said method. The second crash was caused by trying to message garbage.
Thus, the most likely conclusion is that both crashes are symptoms of a single problem; you have an object that is being prematurely released or over-released.
In particular, your table view's data source is being released before or while a table is reloading.
I suspect that UITableView is trying to call the data source's method to create a cell. You could confirm this by setting a breakpoint on said method and looking at the stack trace. If my bet is correct, you'll see the _createPreparedCellForGlobal... method in the trace.
Without knowing details of your app, hard to say. Most likely, this is timing related issue between data being loaded on the screen and the user doing something that causes a request to be canceled earlier than the table view is done loading, causing your data source to be deallocated out from under the table (which can happen because the table view has an assign reference to your object; a non-retaining reference).
To try and reproduce, focus on:
• slow network connection or variable bandwidth (if your app is client/server)
• do things the user might do that causes operations to cancel
• quickly navigate between views without waiting for the update to complete drawing
In your comments, you mention that you are trying on "two different iPhones". Try on other device types and across different network configurations.
Related
I am getting below crash logs across all iOS versions. However, I am not able to figure out the exact cause of this. Is it something to do with accessing a de-allocated object? If yes, is there a way to replicate the scenario since I am not able to.
Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x180771b90 objc_msgSend + 16
1 CoreGraphics 0x182574568 CGColorRetain + 28
2 CoreGraphics 0x182609088 CGGStateSetStrokeColor + 64
3 UIKit 0x186893698 -[UIKBHandwritingStrokeView drawRect:] + 692
4 UIKit 0x1862e2678 -[UIView(CALayerDelegate) drawLayer:inContext:] + 368
5 QuartzCore 0x183c16228 -[CALayer drawInContext:] + 260
6 QuartzCore 0x183c008ac CABackingStoreUpdate_ + 2432
7 QuartzCore 0x183d18360 ___ZN2CA5Layer8display_Ev_block_invoke + 52
8 QuartzCore 0x183bffa88 CA::Layer::display_() + 1368
9 QuartzCore 0x183be17a8 CA::Layer::display_if_needed(CA::Transaction*) + 228
10 QuartzCore 0x183be1494 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 44
11 QuartzCore 0x183be0ab8 CA::Context::commit_transaction(CA::Transaction*) + 252
12 QuartzCore 0x183be0818 CA::Transaction::commit() + 500
13 UIKit 0x186256ff4 _UIApplicationHandleEventQueue + 4980
14 CoreFoundation 0x1810b109c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
15 CoreFoundation 0x1810b0b30 __CFRunLoopDoSources0 + 540
16 CoreFoundation 0x1810ae830 __CFRunLoopRun + 724
17 CoreFoundation 0x180fd8c50 CFRunLoopRunSpecific + 384
18 GraphicsServices 0x1828c0088 GSEventRunModal + 180
19 UIKit 0x1862c2088 UIApplicationMain + 204
20 Smartphone 0x1000e0b78 main (main.m:13)
21 libdispatch.dylib 0x180b768b8 (Missing)
Also I am not able to figure out where exactly the crash is happening. Since I am getting these as part of release build.
About 10+ crash reported by crittercism.
Name: SIGSEGV
Reason: SEGV_MAPERR
Seems it is a UIScrollView/UITableView animating or scrolling issue.
How can I find the root cause?
Stack:
0
libobjc.A.dylib 0x0000000195fafbd0 objc_msgSend + 12
1
UIKit 0x00000001892b1db8 -[UIScrollView(UIScrollViewInternal) _delegateScrollViewAnimationEnded] + 64
2
UIKit 0x00000001892b1d30 -[UIScrollView(UIScrollViewInternal) _scrollViewAnimationEnded:finished:] + 204
3
UIKit 0x0000000189366814 -[UIAnimator stopAnimation:] + 500
4
UIKit 0x0000000189366248 -[UIAnimator(Static) _advanceAnimationsOfType:withTimestamp:] + 332
5
QuartzCore 0x0000000188b4629c CA::Display::DisplayLinkItem::dispatch() + 28
6
QuartzCore 0x0000000188b46134 CA::Display::DisplayLink::dispatch_items() + 320
7
IOKit 0x0000000185921470 IODispatchCalloutFromCFMessage + 372
8
CoreFoundation 0x0000000184712dc4 __CFMachPortPerform + 176
9
CoreFoundation 0x0000000184727a54 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
10
CoreFoundation 0x00000001847279b4 __CFRunLoopDoSource1 + 432
11
CoreFoundation 0x0000000184725934 __CFRunLoopRun + 1636
12
CoreFoundation 0x00000001846512d4 CFRunLoopRunSpecific + 392
13
GraphicsServices 0x000000018de676fc GSEventRunModal + 164
14
UIKit 0x0000000189216fac UIApplicationMain + 1484
15
MyApp 0x000000010001d280 main (main.m:14)
16
libdyld.dylib 0x000000019661aa08 start + 0
I've seen this happen when a controller and/or its table is deallocated during an animation. The OS still triggers delegate methods (e.g., -scrollViewDidEndScrollingAnimation: or -scrollViewDidEndDecelerating:) when it finishes with the animation, but because the objects no longer exist things get weird.
The best fix is to nil the delegate in the controller's dealloc method.
I'm using Crittercism (SDK 4.1.2) crash reporting service to catch reports on my iOS app. i've been getting this crash many times and i've no idea why it's happening.
Name: SIGSEGV - Reason: Main
Crashed Thread
0 libobjc.A.dylib 0x397c4b26 objc_msgSend + 6
1 UIKit 0x31965a2d -[UIScrollView(UIScrollViewInternal) _scrollViewAnimationEnded:finished:] + 177
2 UIKit 0x31a0e4b3 -[UIAnimator stopAnimation:] + 471
3 UIKit 0x31a0de9d -[UIAnimator(Static) _advanceAnimationsOfType:withTimestamp:] + 285
4 UIKit 0x31a0dd7d -[UIAnimator(Static) _LCDHeartbeatCallback:] + 53
5 QuartzCore 0x315419cf _ZN2CA7Display15DisplayLinkItem8dispatchEv + 99
6 QuartzCore 0x31541779 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 345
7 IOMobileFramebuffer 0x3411b76d IOMobileFramebufferVsyncNotifyFunc + 105
8 IOKit 0x2fdd9a75 IODispatchCalloutFromCFMessage + 249
9 CoreFoundation 0x2f0b7e21 __CFMachPortPerform + 137
10 CoreFoundation 0x2f0c29df __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 35
11 CoreFoundation 0x2f0c297b __CFRunLoopDoSource1 + 347
12 CoreFoundation 0x2f0c114f __CFRunLoopRun + 1399
13 CoreFoundation 0x2f02bc27 CFRunLoopRunSpecific + 523
14 CoreFoundation 0x2f02ba0b CFRunLoopRunInMode + 107
15 GraphicsServices 0x33cff283 GSEventRunModal + 139
16 UIKit 0x318cf049 UIApplicationMain + 1137
17 AppName 0x000b1fef main + 67
Not sure if this is the case for you, but I've had a similar crash caused by a button in an UIView trying to invoke a callback method on a already released object. The UI was displayed, and then the object was released.
I have been trying to figure out what is causing one of the top crashes in my iOS application. It looks like there is some layout happening on a background thread which is causing it to crash. Is there any way to determine what I might be doing that is triggering this relayout? I assume from the stack that it is related to a UIWebView when my app is being brought back into the foreground.
Other stackoverflow threads on the topic seem to mention things like triggering a table reload on a background thread. As far as I can see all the webView delegate methods get called on the main thread. Is there some case where this is not true or are there some other methods which get called on a background thread and I'm just not aware?
Web Thread - Crashed.
0 WebCore _WebTryThreadLock(bool) + 297
1 WebCore _WebTryThreadLock(bool) + 288
2 WebCore WebThreadLock + 66
3 UIKit -[UIWebDocumentView(UIWebDocumentViewTextSelecting) selectionBaseWritingDirection] + 10
4 UIKit -[UITextField _currentTextAlignment] + 86
5 UIKit -[UITextField _showsClearButtonWhenNonEmpty:] + 58
6 UIKit -[UITextField _textRectForBounds:forEditing:] + 678
7 UIKit -[UITextField editingRectForBounds:] + 52
8 UIKit -[UITextField editRect] + 70
9 UIKit -[UITextField layoutSubviews] + 1320
10 UIKit -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 258
11 QuartzCore -[CALayer layoutSublayers] + 214
12 QuartzCore CA::Layer::layout_if_needed(CA::Transaction*) + 460
13 QuartzCore CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
14 QuartzCore CA::Context::commit_transaction(CA::Transaction*) + 238
15 QuartzCore CA::Transaction::commit() + 316
16 QuartzCore CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 60
17 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
18 CoreFoundation __CFRunLoopDoObservers + 276
19 CoreFoundation CFRunLoopRunSpecific + 394
20 CoreFoundation CFRunLoopRunInMode + 104
21 WebCore RunWebThread(void*) + 444
22 libsystem_c.dylib pthread_start + 308
Main - Thread
0 libsystem_kernel.dylib __psynch_mutexwait + 24
1 libsystem_c.dylib pthread_mutex_lock + 392
2 WebCore _WebTryThreadLock(bool) + 336
3 WebCore WebThreadLock + 66
4 WebKit -[WebDatabasePauser applicationWillEnterForeground] + 16
5 CoreFoundation _CFXNotificationPost + 1426
6 Foundation -[NSNotificationCenter postNotificationName:object:userInfo:] + 72
7 UIKit -[UIApplication _sendWillEnterForegroundCallbacks] + 154
8 UIKit -[UIApplication _handleApplicationResumeEvent:] + 1094
9 UIKit -[UIApplication handleEvent:withNewEvent:] + 1292
10 UIKit -[UIApplication sendEvent:] + 72
11 UIKit _UIApplicationHandleEvent + 6154
12 GraphicsServices _PurpleEventCallback + 590
13 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
14 CoreFoundation __CFRunLoopDoSources0 + 212
15 CoreFoundation __CFRunLoopRun + 646
16 CoreFoundation CFRunLoopRunSpecific + 356
17 CoreFoundation CFRunLoopRunInMode + 104
18 GraphicsServices GSEventRunModal + 74
19 UIKit UIApplicationMain + 1120
20 AppName main.m line 23
It seems you are updating UI on the background thread, in your code add this line wherever you are updating your UI and you are fetching data on the background thread:
dispatch_async(dispatch_get_main_queue(), ^{
// Update data here
});
As soon as you, rather code feels that data is there on device and it's time to update the UI corresponding to new data then try and bring back main thread in action.
Hope it helps.
I have a crash that's happening in user's build that I cannot reproduce on my end. What's the best way to go about finding out what causes this?
Specifically, if I want to NSLog or catch the exception, where should I do this (based on the crash log below)? NOTE: The tableview uses custom UITableViewCell.
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x361db88f __exceptionPreprocess + 163
1 libobjc.A.dylib 0x37430259 objc_exception_throw + 33
2 CoreFoundation 0x361db789 +[NSException raise:format:] + 1
3 Foundation 0x375fd3a3 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 91
4 UIKit 0x30eb1163 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 739
5 UIKit 0x30eb0181 -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1077
6 UIKit 0x30eaf90b -[UITableView layoutSubviews] + 207
7 UIKit 0x30e540df -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 183
8 CoreFoundation 0x3613a1fb -[NSObject performSelector:withObject:] + 43
9 QuartzCore 0x37f26aa5 -[CALayer layoutSublayers] + 217
10 QuartzCore 0x37f266bd CA::Layer::layout_if_needed(CA::Transaction*) + 217
11 QuartzCore 0x37f2a843 CA::Context::commit_transaction(CA::Transaction*) + 227
12 QuartzCore 0x37f2a57f CA::Transaction::commit() + 315
13 QuartzCore 0x37f224b9 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 57
14 CoreFoundation 0x361afb1b __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 19
15 CoreFoundation 0x361add57 __CFRunLoopDoObservers + 259
16 CoreFoundation 0x361ae0b1 __CFRunLoopRun + 761
17 CoreFoundation 0x361314a5 CFRunLoopRunSpecific + 301
18 CoreFoundation 0x3613136d CFRunLoopRunInMode + 105
19 GraphicsServices 0x324f1439 GSEventRunModal + 137
20 UIKit 0x30e7ee7d UIApplicationMain + 1081
Most likely, it's the code involving table row/section insertion/deletion/move. It's a real pain to debug these without seeing error messages in the console. I would just focus on the places where I dynamically modify the table view.