While checking the issues reported by Crashlytics, it seems that I have a EXC_BREAKPOINT error for the following line:
self.caloriesFor100 = Int((cartFood.nbCalories.floatValue / 100) * cartFood.quantite.floatValue)
caloriesFor100 is a Int.
cartFood.nbCalories is an NSNumber which is supposed to have float values.
cartFood.quantite is also an NSNumber which is supposed to have float values.
I did not succeed to reproduce the issue. What could possibly cause an EXC_BREAKPOINT in this code?
Full stack trace:
Crashed: com.apple.main-thread
0 LSDP 0x10269ccbc specialized CartFoodModelinit(_:) (CartFoodModel.swift:88)
1 LSDP 0x10268a570 specialized CartFoodCell.cartFoodObjc (CartFoodModel.swift)
2 LSDP 0x102689600 #objc CartFoodCell.cartFoodObjc (<compiler-generated>)
3 LSDP 0x102664c7c -[PanierDuJourViewController tableView:cellForRowAtIndexPath:] (PanierDuJourViewController.m:156)
4 UIKit 0x18bf10148 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 668
5 UIKit 0x18bf0fe00 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80
6 UIKit 0x18bf0eb1c -[UITableView _updateVisibleCellsNow:isRecursive:] + 2280
7 UIKit 0x18bf0a668 -[UITableView layoutSubviews] + 140
8 UIKit 0x18be47770 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1420
9 QuartzCore 0x1863e925c -[CALayer layoutSublayers] + 184
10 QuartzCore 0x1863ed3ec CA::Layer::layout_if_needed(CA::Transaction*) + 324
11 QuartzCore 0x186359aa0 CA::Context::commit_transaction(CA::Transaction*) + 320
12 QuartzCore 0x1863815d0 CA::Transaction::commit() + 580
13 UIKit 0x18c22054c _UIApplicationFlushRunLoopCATransactionIfTooLate + 172
14 UIKit 0x18c7fd4c0 __handleEventQueueInternal + 5520
15 UIKit 0x18c7f6258 __handleHIDEventFetcherDrain + 152
16 CoreFoundation 0x18221b404 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
17 CoreFoundation 0x18221ac2c __CFRunLoopDoSources0 + 276
18 CoreFoundation 0x18221879c __CFRunLoopRun + 1204
19 CoreFoundation 0x182138da8 CFRunLoopRunSpecific + 552
20 GraphicsServices 0x18411b020 GSEventRunModal + 100
21 UIKit 0x18c11978c UIApplicationMain + 236
22 LSDP 0x1025fce28 main (main.m:16)
23 libdyld.dylib 0x181bc9fc0 start + 4
You may catch this exception in case if NSNumber property will be nil. So maybe it is better to change nbCalories to has an option value.
I found a similar problem and its solution here.
Since your app crashes at tableView:cellForRowAtIndexPath:, it might be that the cell should display an entry of your table (CartFoodCell.cartFoodObjc) that no longer exists.
But without more code, this is just a guess. Please double check it in your code.
Related
I seem to be getting this error after my new release and its only happening on iOS 13 with most cases of upto 83% of the crash happening on iOS 13.3.1. I am not sure how to fix this error and I have been going through the code and cannot seem to figure out the change in iOS 13 that causes scrollViewDidScroll delegate method to crash the app.
Any help is greatly appreciated. It is also important to note that I haven't been able to reproduce this error, it only happens to users in production.
Crashed: com.apple.main-thread
EXC_BREAKPOINT 0x0000000104620bb0
Crashed: com.apple.main-thread
0 Motoz-AppStore 0x104620bb0 ProfileBrowserViewController.scrollViewDidScroll(_:) + 4299967408 (<compiler-generated>:4299967408)
1 Motoz-AppStore 0x104620d54 #objc ProfileBrowserViewController.scrollViewDidScroll(_:) + 4299967828 (<compiler-generated>:4299967828)
2 UIKitCore 0x1be3c6a24 -[UIScrollView _notifyDidScroll] + 76
3 UIKitCore 0x1be3b0c34 -[UIScrollView setContentOffset:] + 1016
4 UIKitCore 0x1bd8153d4 -[UICollectionView setContentOffset:] + 48
5 UIKitCore 0x1be3cdd28 -[UIScrollView _adjustContentOffsetIfNecessary] + 60
6 UIKitCore 0x1be3af1cc -[UIScrollView setFrame:] + 484
7 UIKitCore 0x1bd802e7c -[UICollectionView setFrame:] + 460
8 UIKitCore 0x1be41b878 -[UIView(Geometry) _applyAutoresizingMaskWithOldSuperviewSize:] + 576
9 UIKitCore 0x1be41c510 -[UIView(Geometry) _resizeWithOldSuperviewSize:] + 236
10 UIKitCore 0x1be355b84 -[UIScrollView(_UIOldConstraintBasedLayoutSupport) _resizeWithOldSuperviewSize:] + 52
11 CoreFoundation 0x1b9eed95c __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 16
12 CoreFoundation 0x1b9df0fb0 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 416
13 UIKitCore 0x1be41b5e4 -[UIView(Geometry) resizeSubviewsWithOldSize:] + 156
14 UIKitCore 0x1be419938 -[UIView(Geometry) setFrame:] + 700
15 UIKitCore 0x1bd8e519c -[UINavigationController _startCustomTransition:] + 1212
16 UIKitCore 0x1bd8f9168 -[UINavigationController _startDeferredTransitionIfNeeded:] + 680
17 UIKitCore 0x1bd8fa55c -[UINavigationController __viewWillLayoutSubviews] + 164
18 UIKitCore 0x1bd8dd9e0 -[UILayoutContainerView layoutSubviews] + 224
19 UIKitCore 0x1be43617c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2140
20 QuartzCore 0x1c099e2c0 -[CALayer layoutSublayers] + 284
21 QuartzCore 0x1c09a443c CA::Layer::layout_if_needed(CA::Transaction*) + 480
22 QuartzCore 0x1c09af140 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 136
23 QuartzCore 0x1c08f7884 CA::Context::commit_transaction(CA::Transaction*, double) + 304
24 QuartzCore 0x1c0921574 CA::Transaction::commit() + 676
25 QuartzCore 0x1c0921f68 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
26 CoreFoundation 0x1b9e97e68 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
27 CoreFoundation 0x1b9e92d54 __CFRunLoopDoObservers + 416
28 CoreFoundation 0x1b9e93320 __CFRunLoopRun + 1308
29 CoreFoundation 0x1b9e92adc CFRunLoopRunSpecific + 464
30 GraphicsServices 0x1c3e33328 GSEventRunModal + 104
31 UIKitCore 0x1bdfa063c UIApplicationMain + 1936
32 Motoz-AppStore 0x1043fed70 main + 17 (TeraHeaderView.swift:17)
33 libdyld.dylib 0x1b9d1c360 start + 4
I can not say a concrete answer unless you show a piece of code but there is a possibility that error might occur because of delegation structure. Just in case check your delegation of scrollviews(tableviews, collection views, embedded web-views as well). Please check the link link for more info.
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.
I have my app in alpha test, and using fabric to capture the crash logs. I had encountered a crash, and I have the below trace but have no idea what is going on. I tried to reproduce it with Xcode, but hardly can reproduce.
Could any one help on this? or share some ideas?
Thread : Crashed: com.apple.main-thread
0 libsystem_platform.dylib 0x0000000197c7d8d4 OSAtomicCompareAndSwap32Barrier + 12
1 libobjc.A.dylib 0x0000000197468120 realizeClass(objc_class*) + 100
2 libobjc.A.dylib 0x000000019746c930 lookUpImpOrForward + 224
3 libobjc.A.dylib 0x0000000197477db8 _objc_msgSend_uncached_impcache + 56
4 UIKit 0x000000018b66bef4 -[UINavigationController _startCustomTransition:] + 972
5 UIKit 0x000000018b57d630 -[UINavigationController _startDeferredTransitionIfNeeded:] + 468
6 UIKit 0x000000018b57d3fc -[UINavigationController __viewWillLayoutSubviews] + 56
7 UIKit 0x000000018b57d37c -[UILayoutContainerView layoutSubviews] + 200
8 UIKit 0x000000018b4c5d2c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 572
9 QuartzCore 0x000000018ae1d994 -[CALayer layoutSublayers] + 168
10 QuartzCore 0x000000018ae18564 CA::Layer::layout_if_needed(CA::Transaction*) + 320
11 QuartzCore 0x000000018ae18408 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
12 QuartzCore 0x000000018ae17c08 CA::Context::commit_transaction(CA::Transaction*) + 276
13 QuartzCore 0x000000018ae1798c CA::Transaction::commit() + 436
14 UIKit 0x000000018b4c7c48 _UIApplicationHandleEventQueue + 1700
15 CoreFoundation 0x0000000186cd29ec __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
16 CoreFoundation 0x0000000186cd1c90 __CFRunLoopDoSources0 + 264
17 CoreFoundation 0x0000000186ccfd40 __CFRunLoopRun + 712
18 CoreFoundation 0x0000000186bfd0a4 CFRunLoopRunSpecific + 396
19 GraphicsServices 0x000000018fd975a4 GSEventRunModal + 168
20 UIKit 0x000000018b52eaa4 UIApplicationMain + 1488
21 MCompass 0x00000001001631c8 main (main.m:16)
22 libdyld.dylib 0x0000000197ad2a08 start + 4
It is hard to tell without seeing some more details, but maybe this can help: http://aplus.rs/2013/beware-a-crashing-bug-lurks-with-uinavigationcontroller-transitions/
I have been getting a rare crash in my app. I am able to track it via hockey app tool integrated with the app. But, unfortunately i am not able to find out any clue about it so as to resolve it.
The crash is happening in the main method of my application in thread 0. I would like to post the stack trace for better analysis. Here it is.
Thread 0 Crashed:
0 libobjc.A.dylib 0x34ed7f46 _objc_msgSend + 6
1 UIKit 0x2ac884cf -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 472
2 UIKit 0x2ac88593 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 52
3 UIKit 0x2ac7dd21 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2266
4 UIKit 0x2aa962df -[UITableView layoutSubviews] + 184
5 UIKit 0x2a9c0677 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 512
6 QuartzCore 0x2a3e8ccd -[CALayer layoutSublayers] + 134
7 QuartzCore 0x2a3e46b5 CA::Layer::layout_if_needed(CA::Transaction*) + 358
8 QuartzCore 0x2a3e453d CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 14
9 QuartzCore 0x2a3e3f21 CA::Context::commit_transaction(CA::Transaction*) + 222
10 QuartzCore 0x2a3e3d25 CA::Transaction::commit() + 322
11 UIKit 0x2ac0bc43 _UIWindowUpdateVisibleContextOrder + 208
12 UIKit 0x2ac0bad5 +[UIWindow _prepareWindowsPassingTestForAppResume:] + 14
13 UIKit 0x2ac2c8f3 -[UIApplication _updateSnapshotAndStateRestorationArchiveForBackgroundEvent:saveState:exitIfCouldNotRestoreState:] + 200
14 UIKit 0x2ac2bda3 __80-[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:]_block_invoke_2 + 112
15 libdispatch.dylib 0x3542b8cb _dispatch_call_block_and_release + 8
16 libdispatch.dylib 0x3542b8b7 _dispatch_client_callout + 20
17 libdispatch.dylib 0x3542f0bf __dispatch_main_queue_callback_4CF + 723
18 CoreFoundation 0x274eabe9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 6
19 CoreFoundation 0x274e92e9 __CFRunLoopRun + 1510
20 CoreFoundation 0x27437621 _CFRunLoopRunSpecific + 477
21 CoreFoundation 0x27437433 _CFRunLoopRunInMode + 107
22 GraphicsServices 0x2e7bd0a9 _GSEventRunModal + 137
23 UIKit 0x2aa22359 _UIApplicationMain + 1441
The crash being in the main thread, i don't get any clue of where and how to start tracing this crash.
Any help would be highly appreciated.
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.