Crashlytics thread crashed only on iOS13 built with Xcode11

bemul12 picture bemul12 · Oct 15, 2019 · Viewed 8.8k times · Source

My app is crashed only on iOS13 with the following call stack:

#57. Crashed: com.twitter.crashlytics.ios.exception
0  myapp                          0x105d6d494 CLSProcessRecordAllThreads + 376 (CLSProcess.c:376)
1  myapp                          0x105d6d87c CLSProcessRecordAllThreads + 407 (CLSProcess.c:407)
2  myapp                          0x105d5d58c CLSHandler + 26 (CLSHandler.m:26)
3  myapp                          0x105d6bab4 __CLSExceptionRecord_block_invoke + 198 (CLSException.mm:198)
4  libdispatch.dylib              0x1be5c100c _dispatch_client_callout + 20
5  libdispatch.dylib              0x1be5cd804 _dispatch_lane_barrier_sync_invoke_and_complete + 60
6  myapp                          0x105d6b55c CLSExceptionRecord + 205 (CLSException.mm:205)
7  myapp                          0x105d6b390 CLSExceptionRecordNSException + 102 (CLSException.mm:102)
8  myapp                          0x105d6afb4 CLSTerminateHandler() + 258 (CLSException.mm:258)
9  libc++abi.dylib                0x1be6d9634 std::__terminate(void (*)()) + 20
10 libc++abi.dylib                0x1be6d8f58 __cxa_get_exception_ptr + 34
11 libc++abi.dylib                0x1be6d8f10 __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*) + 126
12 libobjc.A.dylib                0x1be6341f8 _objc_exception_destructor(void*) + 362
13 Foundation                     0x1bee05434 -[NSISEngine tryToOptimizeReturningMutuallyExclusiveConstraints] + 322
14 Foundation                     0x1bebfeb94 -[NSISEngine _optimizeWithoutRebuilding] + 72
15 Foundation                     0x1bebfeaa8 -[NSISEngine optimize] + 116
16 Foundation                     0x1bebfe718 -[NSISEngine performPendingChangeNotifications] + 116
17 UIKitCore                      0x1c2e447c4 -[UIView(Hierarchy) layoutSubviews] + 316
18 UIKitCore                      0x1c23c6948 -[UIButton layoutSubviews] + 596
19 UIKitCore                      0x1c2e57abc -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2156
20 libobjc.A.dylib                0x1be62faf0 -[NSObject performSelector:withObject:] + 68
21 QuartzCore                     0x1c53f60f4 -[CALayer layoutSublayers] + 292
22 QuartzCore                     0x1c53f63fc CA::Layer::layout_if_needed(CA::Transaction*) + 484
23 QuartzCore                     0x1c5409964 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 140
24 QuartzCore                     0x1c534ec1c CA::Context::commit_transaction(CA::Transaction*, double) + 308
25 QuartzCore                     0x1c5379bd8 CA::Transaction::commit() + 684
26 QuartzCore                     0x1c537abc0 CA::Transaction::release_thread(void*) + 232
27 libsystem_pthread.dylib        0x1be62c3c0 _pthread_tsd_cleanup + 584
28 libsystem_pthread.dylib        0x1be624dbc _pthread_exit + 84
29 libsystem_pthread.dylib        0x1be626de8 _pthread_wqthread_legacy_worker_wrap + 98
30 libsystem_pthread.dylib        0x1be626b30 _pthread_wqthread + 424
31 libsystem_pthread.dylib        0x1be62cc78 start_wqthread + 8

--

Fatal Exception: NSInternalInconsistencyException
Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.
0  CoreFoundation                 0x1be919c30 __exceptionPreprocess
1  libobjc.A.dylib                0x1be6340c8 objc_exception_throw
2  Foundation                     0x1bee05434 -[NSISEngine tryToOptimizeReturningMutuallyExclusiveConstraints]
3  Foundation                     0x1bebfeb94 -[NSISEngine _optimizeWithoutRebuilding]
4  Foundation                     0x1bebfeaa8 -[NSISEngine optimize]
5  Foundation                     0x1bebfe718 -[NSISEngine performPendingChangeNotifications]
6  UIKitCore                      0x1c2e447c4 -[UIView(Hierarchy) layoutSubviews]
7  UIKitCore                      0x1c23c6948 -[UIButton layoutSubviews]
8  UIKitCore                      0x1c2e57abc -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
9  libobjc.A.dylib                0x1be62faf0 -[NSObject performSelector:withObject:]
10 QuartzCore                     0x1c53f60f4 -[CALayer layoutSublayers]
11 QuartzCore                     0x1c53f63fc CA::Layer::layout_if_needed(CA::Transaction*)
12 QuartzCore                     0x1c5409964 CA::Layer::layout_and_display_if_needed(CA::Transaction*)
13 QuartzCore                     0x1c534ec1c CA::Context::commit_transaction(CA::Transaction*, double)
14 QuartzCore                     0x1c5379bd8 CA::Transaction::commit()
15 QuartzCore                     0x1c537abc0 CA::Transaction::release_thread(void*)
16 libsystem_pthread.dylib        0x1be62c3c0 _pthread_tsd_cleanup
17 libsystem_pthread.dylib        0x1be624dbc _pthread_exit
18 libsystem_pthread.dylib        0x1be626de8 _pthread_wqthread_legacy_worker_wrap
19 libsystem_pthread.dylib        0x1be626b30 _pthread_wqthread
20 libsystem_pthread.dylib        0x1be62cc78 start_wqthread

I absolutely do not have any idea, what can occure this problem and how can i reproduce. It crashes randomly. I use Crashlytics v3.14 in my project. Does anybody face with the same problem?

Answer

own2pwn picture own2pwn · Oct 16, 2019

Do you have google ads enabled in your app? It then could be a bug in Google ads sdk or be a bug in WebKit SDK implementation on iOS 13. (sry I can't comment, so I post this as answer)

Piggybacking off of this -- Reading through above linked thread, the "official" solution from the Google Ads team as of Nov 19 2019 is to modify your App's plist to include the following key/pair to use wkwebview instead of uiwebview.

<key>gad_preferred_webview</key>
<string>wkwebview</string>

Source: https://groups.google.com/forum/#!category-topic/google-admob-ads-sdk/ios/I4EEWrPPbSc