Interpretation of iOS crash log with -[UIApplication _cachedSystemAnimationFenceCreatingIfNecessary:]

1

My submission to the App Store was rejected due to a crash. However, I am unable to reproduce the crash on multiple hardware devices and simulators. I've symbolicated the crash log, and it seems the issue is occurring in an area of code where the app is fetching some data from a server and closing a UIAlertController that notifies the user to "Please wait..." Below is the crash log.

Date/Time:           2017-05-06 00:27:06.7009 +0700
Launch Time:         2017-05-06 00:26:43.8793 +0700
OS Version:          iPhone OS 10.3.1 (14E304)
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  1

Application Specific Information:
abort() called

Filtered syslog:
None found

Last Exception Backtrace:
0   CoreFoundation                  0x18c47efd8 __exceptionPreprocess + 124
1   libobjc.A.dylib                 0x18aee0538 objc_exception_throw + 56
2   CoreFoundation                  0x18c47eeac +[NSException raise:format:arguments:] + 104
3   Foundation                      0x18cf16710 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 112
4   UIKit                           0x192823454 -[UIApplication _cachedSystemAnimationFenceCreatingIfNecessary:] + 196
5   UIKit                           0x192823514 -[UIApplication _systemAnimationFenceCreatingIfNecessary:] + 24
6   UIKit                           0x19287c7a0 +[UIWindow _synchronizedDrawingFence] + 116
7   UIKit                           0x192a3a150 +[_UIKeyboardChangedInformation informationForKeyboardUp:withIAV:] + 104
8   UIKit                           0x192d338d4 -[_UIRemoteKeyboards prepareToMoveKeyboard:withIAV:showing:forScreen:] + 464
9   UIKit                           0x19266bc04 -[UIPeripheralHost(UIKitInternal) setInputViews:animationStyle:] + 820
10  UIKit                           0x192688cf4 -[UIPeripheralHost(UIKitInternal) _restoreInputViewsWithId:animated:] + 584
11  UIKit                           0x19291bd64 -[UIViewController _restoreInputViewsForPresentation] + 280
12  UIKit                           0x1928f6e3c -[UIPresentationController runTransitionForCurrentState] + 1560
13  UIKit                           0x1928f50f8 -[UIPresentationController _dismissWithAnimationController:interactionController:target:didEndSelector:] + 764
14  UIKit                           0x19291b8c0 -[UIViewController _dismissViewControllerWithAnimationController:interactionController:completion:] + 464
15  UIKit                           0x1926d0cd4 -[UIViewController _dismissViewControllerWithTransition:from:completion:] + 600
16  UIKit                           0x192678b6c -[UIViewController dismissViewControllerWithTransition:completion:] + 1144
17  UIKit                           0x19267894c -[UIViewController dismissViewControllerWithTransition:completion:] + 600
18  UIKit                           0x19291ab68 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 524
19  UIKit                           0x1926786c0 -[UIViewController dismissViewControllerAnimated:completion:] + 152
20  DinokEtp                        0x1001014c4 specialized ViewController.(downloadCaseTypesFile(workFlowVersionMobileShouleBeOn : Double, validateUserResponse : ValidateUserResponse) -> ()).(closure #1) (ViewController.swift:360)
21  DinokEtp                        0x1000fd84c ViewController.(downloadCaseTypesFile(workFlowVersionMobileShouleBeOn : Double, validateUserResponse : ValidateUserResponse) -> ()).(closure #1) (ViewController.swift:0)
22  DinokEtp                        0x100101b38 partial apply for ViewController.(downloadCaseTypesFile(workFlowVersionMobileShouleBeOn : Double, validateUserResponse : ValidateUserResponse) -> ()).(closure #1) (ViewController.swift:0)
23  CFNetwork                       0x18ca89358 __85-[__NSURLSessionLocal downloadTaskForRequest:downloadFilePath:resumeData:completion:]_block_invoke + 32
24  CFNetwork                       0x18caeb18c __50-[__NSCFLocalDownloadTask _private_fileCompletion]_block_invoke.321 + 84
25  Foundation                      0x18cf4d804 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
26  Foundation                      0x18ce92760 -[NSBlockOperation main] + 96
27  Foundation                      0x18ce82b18 -[__NSOperationInternal _start:] + 612
28  Foundation                      0x18cf4fba0 __NSOQSchedule_f + 228
29  libdispatch.dylib               0x18b3369a0 _dispatch_client_callout + 16
30  libdispatch.dylib               0x18b344ad4 _dispatch_queue_serial_drain + 928
31  libdispatch.dylib               0x18b33a2cc _dispatch_queue_invoke + 884
32  libdispatch.dylib               0x18b346a50 _dispatch_root_queue_drain + 540
33  libdispatch.dylib               0x18b3467d0 _dispatch_worker_thread3 + 124
34  libsystem_pthread.dylib         0x18b53f1d0 _pthread_wqthread + 1096
35  libsystem_pthread.dylib         0x18b53ed7c start_wqthread + 4


Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0:
0   libsystem_kernel.dylib          0x000000018b45b224 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x000000018b45b09c mach_msg + 72
2   CoreFoundation                  0x000000018c42ce88 __CFRunLoopServiceMachPort + 192
3   CoreFoundation                  0x000000018c42aadc __CFRunLoopRun + 1060
4   CoreFoundation                  0x000000018c35ad94 CFRunLoopRunSpecific + 424
5   GraphicsServices                0x000000018ddc4074 GSEventRunModal + 100
6   UIKit                           0x000000019260c130 UIApplicationMain + 208
7   DinokEtp                        0x00000001000654bc main (EMSCaseUpload.swift:14)
8   libdyld.dylib                   0x000000018b36959c start + 4

Thread 1 name:  Dispatch queue: NSOperationQueue 0x17003e2c0 :: NSOperation 0x17025e5d0 (QOS: DEFAULT)
Thread 1 Crashed:
0   libsystem_kernel.dylib          0x000000018b479014 __pthread_kill + 8
1   libsystem_pthread.dylib         0x000000018b543334 pthread_kill + 112
2   libsystem_c.dylib               0x000000018b3ed9c4 abort + 140
3   libc++abi.dylib                 0x000000018aeb91b0 __cxa_bad_cast + 0
4   libc++abi.dylib                 0x000000018aed2c04 default_unexpected_handler() + 0
5   libobjc.A.dylib                 0x000000018aee0820 _objc_terminate() + 124
6   libc++abi.dylib                 0x000000018aecf5d4 std::__terminate(void (*)()) + 16
7   libc++abi.dylib                 0x000000018aecf640 std::terminate() + 60
8   libdispatch.dylib               0x000000018b3369b4 _dispatch_client_callout + 36
9   libdispatch.dylib               0x000000018b344ad4 _dispatch_queue_serial_drain + 928
10  libdispatch.dylib               0x000000018b33a2cc _dispatch_queue_invoke + 884
11  libdispatch.dylib               0x000000018b346a50 _dispatch_root_queue_drain + 540
12  libdispatch.dylib               0x000000018b3467d0 _dispatch_worker_thread3 + 124
13  libsystem_pthread.dylib         0x000000018b53f1d0 _pthread_wqthread + 1096
14  libsystem_pthread.dylib         0x000000018b53ed7c start_wqthread + 4

Thread 2:
0   libsystem_pthread.dylib         0x000000018b53ed78 start_wqthread + 0

Thread 3 name:  com.apple.uikit.eventfetch-thread
Thread 3:
0   libsystem_kernel.dylib          0x000000018b45b224 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x000000018b45b09c mach_msg + 72
2   CoreFoundation                  0x000000018c42ce88 __CFRunLoopServiceMachPort + 192
3   CoreFoundation                  0x000000018c42aadc __CFRunLoopRun + 1060
4   CoreFoundation                  0x000000018c35ad94 CFRunLoopRunSpecific + 424
5   Foundation                      0x000000018ce74d64 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6   Foundation                      0x000000018ce95b34 -[NSRunLoop(NSRunLoop) runUntilDate:] + 96
7   UIKit                           0x0000000192f965f8 -[UIEventFetcher threadMain] + 136
8   Foundation                      0x000000018cf722c8 __NSThread__start__ + 996
9   libsystem_pthread.dylib         0x000000018b54175c _pthread_body + 240
10  libsystem_pthread.dylib         0x000000018b54166c _pthread_body + 0
11  libsystem_pthread.dylib         0x000000018b53ed84 thread_start + 4

Thread 4:
0   libsystem_kernel.dylib          0x000000018b479a88 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x000000018b53f274 _pthread_wqthread + 1260
2   libsystem_pthread.dylib         0x000000018b53ed7c start_wqthread + 4

Thread 5:
0   libsystem_pthread.dylib         0x000000018b53ed78 start_wqthread + 0

Thread 6 name:  com.apple.NSURLConnectionLoader
Thread 6:
0   libsystem_kernel.dylib          0x000000018b45b224 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x000000018b45b09c mach_msg + 72
2   CoreFoundation                  0x000000018c42ce88 __CFRunLoopServiceMachPort + 192
3   CoreFoundation                  0x000000018c42aadc __CFRunLoopRun + 1060
4   CoreFoundation                  0x000000018c35ad94 CFRunLoopRunSpecific + 424
5   CFNetwork                       0x000000018cb66ca4 +[NSURLConnection(Loader) _resourceLoadLoop:] + 404
6   Foundation                      0x000000018cf722c8 __NSThread__start__ + 996
7   libsystem_pthread.dylib         0x000000018b54175c _pthread_body + 240
8   libsystem_pthread.dylib         0x000000018b54166c _pthread_body + 0
9   libsystem_pthread.dylib         0x000000018b53ed84 thread_start + 4

Thread 1 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x00000001700f8c37
    x4: 0x000000018aed3b07   x5: 0x000000016de9a850   x6: 0x000000000000006e   x7: 0xffffffffffffffec
    x8: 0x000000000c000000   x9: 0x0000000004000000  x10: 0x000000000000000b  x11: 0x000000000000000b
   x12: 0x0000000000000010  x13: 0x000000018c6c9c0e  x14: 0x0000030000000300  x15: 0x0000000000000000
   x16: 0x0000000000000148  x17: 0x0000000000000000  x18: 0x0000000000000000  x19: 0x0000000000000006
   x20: 0x000000016de9b000  x21: 0x000000016de9a850  x22: 0x00000001700ff380  x23: 0x0000000000000004
   x24: 0x00000001b1ebd400  x25: 0x0000000000000000  x26: 0x00000001b1ebd400  x27: 0x000000016de9b0e0
   x28: 0x0000000000000000   fp: 0x000000016de9a7b0   lr: 0x000000018b543334
    sp: 0x000000016de9a790   pc: 0x000000018b479014 cpsr: 0x00000000
ios
swift
thread-safety
uikit
crash-reports
asked on Stack Overflow May 9, 2017 by SKim • edited Oct 16, 2018 by Paulo Mattos

1 Answer

2

I would recommend double checking that you are not interacting with that UIAlertController (or any other UIKit API) outside the main thread (aka, Thread 0 above). Many UIKit APIs are designed to be used only from the main thread.

Worth noting that the crash happened on Thread 1

If you are in doubt, wrap the call with:

DispatchQueue.main.async {
    // Call UIAlertController code here...
}
answered on Stack Overflow May 9, 2017 by Paulo Mattos • edited May 9, 2017 by Paulo Mattos

User contributions licensed under CC BY-SA 3.0