我们在尝试登录时遇到未知崩溃:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] may only be called from the main thread.'
当您使用键盘输入文本字段信息时,崩溃仅发生在模拟器上。 使用“切换软件键盘”时,一切都很顺利......
我们检查了每个主题但找不到答案。
如果您有任何想法,请提前致谢。
PS:这是完整的日志
2018-05-29 17:50:22.769863+0200 Katch[89138:772858] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] may only be called from the main thread.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010972612b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000108321f41 objc_exception_throw + 48
2 CoreFoundation 0x000000010972b2f2 +[NSException raise:format:arguments:] + 98
3 Foundation 0x0000000107dc2d69 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 UIKit 0x000000010bc7005d -[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] + 380
5 UIKit 0x000000010b1dfd98 -[UIKeyboardImpl setDelegate:force:] + 1596
6 UIKit 0x000000010b6cebcf -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:] + 1271
7 UIKit 0x000000010b6d8480 -[UIPeripheralHost(UIKitInternal) _preserveInputViewsWithId:animated:reset:] + 498
8 UIKit 0x000000010b098130 -[UIViewController _presentViewController:modalSourceViewController:presentationController:animationController:interactionController:completion:] + 1233
9 UIKit 0x000000010b099e94 -[UIViewController _presentViewController:withAnimationController:completion:] + 4621
10 UIKit 0x000000010b09c9a9 __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 99
11 UIKit 0x000000010b09d079 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 532
12 UIKit 0x000000010b09c908 -[UIViewController _presentViewController:animated:completion:] + 181
13 UIKit 0x000000010b09cc67 -[UIViewController presentViewController:animated:completion:] + 159
14 UIKit 0x000000010b0a1fea -[UIViewController _showViewController:withAction:sender:] + 274
15 UIKit 0x000000010b0a204e -[UIViewController showViewController:sender:] + 57
16 UIKit 0x000000010b0d0f2c -[UINavigationController showViewController:sender:] + 215
17 UIKit 0x000000010b0a1f4e -[UIViewController _showViewController:withAction:sender:] + 118
18 UIKit 0x000000010b0a204e -[UIViewController showViewController:sender:] + 57
19 Katch 0x00000001068ae882 _T05Katch29SignUpUserInfosViewControllerC6signInyyFySb_SStcfU_Tf4ngXg_n + 530
20 Katch 0x00000001068af157 _T05Katch29SignUpUserInfosViewControllerC04signC0yyFySb_SStcfU_TATm + 71
21 Katch 0x00000001068af100 _T05Katch29SignUpUserInfosViewControllerC6signInyyFySb_SStcfU_TA + 16
22 Katch 0x00000001068ecc46 _T05Katch12KMSignUpDataC6signInySS4mail_SS8passwordySb_SStc10completiontFyyXlSg_SSSgtcfU_Tf4gdg_n + 2006
23 Katch 0x00000001068edb31 _T05Katch12KMSignUpDataC04signC0yySb_SStc10completion_tFyyXlSg_SSSgtcfU_TATm + 65
24 Katch 0x00000001068edae0 _T05Katch12KMSignUpDataC6signInySS4mail_SS8passwordySb_SStc10completiontFyyXlSg_SSSgtcfU_TA + 16
25 Katch 0x000000010688be27
_T05Katch16KMServiceManagerC7request9Alamofire11DataRequestCAC0B4TypeO3for_s10DictionaryVySSypGSg10parametersALyS2SGSg7headersyyXlSg_SSSgtc10completiontFyAE0F8ResponseVyypGcfU_ + 4743
26 Katch 0x000000010688ceeb _T05Katch16KMServiceManagerC7request9Alamofire11DataRequestCAC0B4TypeO3for_s10DictionaryVySSypGSg10parametersALyS2SGSg7headersyyXlSg_SSSgtc10completiontFyAE0F8ResponseVyypGcfU_TA + 59
27 Alamofire 0x0000000106f93b3e _T09Alamofire11DataRequestC8responseACXDSo13DispatchQueueCSg5queue_x0D10SerializeryAA0B8ResponseVy16SerializedObjectQzGc17completionHandlertAA0biH8ProtocolRzlFyycfU_yycfU_AA0biH0VyypG_Tg5 + 334
28 Alamofire 0x0000000106f9e1ee _T09Alamofire15DownloadRequestC8responseACXDSo13DispatchQueueCSg5queue_x0D10SerializeryAA0B8ResponseVy16SerializedObjectQzGc17completionHandlertAA0biH8ProtocolRzlFyycfU_yycfU_AA0biH0VyypG_Tg5TATm + 62
29 Alamofire 0x0000000106f9ddf0 _T09Alamofire11DataRequestC8responseACXDSo13DispatchQueueCSg5queue_x0D10SerializeryAA0B8ResponseVy16SerializedObjectQzGc17completionHandlertAA0biH8ProtocolRzlFyycfU_yycfU_AA0biH0VyypG_Tg5TA + 16
30 Alamofire 0x0000000106f722f0 _T0Ix_IyB_TR + 32
31 libdispatch.dylib 0x000000010dccb2f7 _dispatch_call_block_and_release + 12
32 libdispatch.dylib 0x000000010dccc33d _dispatch_client_callout + 8
33 libdispatch.dylib 0x000000010dcd2754 _dispatch_continuation_pop + 967
34 libdispatch.dylib 0x000000010dcd0b85 _dispatch_async_redirect_invoke + 780
35 libdispatch.dylib 0x000000010dcd8102 _dispatch_root_queue_drain + 772
36 libdispatch.dylib 0x000000010dcd7da0 _dispatch_worker_thread3 + 132
37 libsystem_pthread.dylib 0x000000010e2645a2 _pthread_wqthread + 1299
38 libsystem_pthread.dylib 0x000000010e26407d start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
答案 0 :(得分:0)
您似乎在后台线程中触发UI调用(呈现视图控制器等)。 UI调用应该在主线程上完成。
AlamoFire通话完成后,您可以将来电包裹在SignUpUserViewController
中:
DispatchQueue.main.async(execute: {
//launch view here
})
注意,我纯粹基于调用堆栈做了一些猜测。如果这不正确,那么触发错误的一些代码可能会有所帮助。