AwaitKit
AwaitKit copied to clipboard
AwaitKit causes unit tests to fail
I've have installed AwaitKit in a project, however have not started to implement it. The addition of it however has now started my Unit Test's to fail with -
Main Thread Checker: UI API called on a background thread: -[UIViewController init]
PID: 10379, TID: 237476, Thread name: (none), Queue name: com.yannickloriot.asyncqueue, QoS: 0
Backtrace:
4 OAuthKit 0x000000010a61fc33 $sSo16UIViewControllerCABycfcTO + 19
5 OAuthKit 0x000000010a61c57f $sSo16UIViewControllerCABycfC + 31
6 OAuthKit 0x000000010a61c2be $s8OAuthKit0A8ProviderC06createA7Manager33_430562AB130E806488074CBA323B7784LL0A5Swift06OAuth2J0CyF + 1470
7 OAuthKit 0x000000010a618657 $s8OAuthKit0A8ProviderCACycfc + 775
8 OAuthKit 0x000000010a6182ec $s8OAuthKit0A8ProviderCACycfC + 60
9 SomeAppName 0x000000010a2018fb $s10SomeAppName16CoreDependenciesC13oauthProvider33_68CD4A43F5E2D568288F593D3DE6E3FCLL8OAuthKit0rG4Type_pvg + 539
10 SomeAppName 0x000000010a201c53 $s10SomeAppName16CoreDependenciesC7authSvcAA15AuthServiceType_pvg + 547
11 SomeAppName 0x000000010a202230 $s10SomeAppName16CoreDependenciesCAA10DependencyA2aDP7authSvcAA15AuthServiceType_pvgTW + 16
12 SomeAppName 0x000000010a1f6b2e $s10SomeAppName15StartInteractorC14checkAuthState10PromiseKit0I0CyytGyF + 238
13 SomeAppName 0x000000010a1f6cf9 $s10SomeAppName15StartInteractorCAA0D7UseCaseA2aDP14checkAuthState10PromiseKit0K0CyytGyFTW + 9
14 SomeAppName 0x000000010a1f7517 $s10SomeAppName14StartPresenterC14checkAuthState33_A43D4EBCFE4D52FAD1D88C1B3EB067FBLLyyFyyKcfU_ + 87
15 SomeAppName 0x000000010a1f7674 $s10SomeAppName14StartPresenterC14checkAuthState33_A43D4EBCFE4D52FAD1D88C1B3EB067FBLLyyFyyKcfU_TA + 20
16 AwaitKit 0x000000010a5b53ef $ss5Error_pIegzo_ytsAA_pIegrzo_TR + 15
17 AwaitKit 0x000000010a5b5484 $ss5Error_pIegzo_ytsAA_pIegrzo_TRTA + 20
18 PromiseKit 0x000000010a881943 $sSo17OS_dispatch_queueC10PromiseKitE5async_5group3qos5flags7executeAC0D0CyxGAC13PMKNamespacerO_So0a1_b1_G0CSg8Dispatch0L3QoSVAQ0L13WorkItemFlagsVxyKctlFyycfU_ + 275
19 PromiseKit 0x000000010a856bcd $sIeg_IeyB_TR + 45
20 libdispatch.dylib 0x00007fff516ba274 _dispatch_block_async_invoke2 + 83
21 libdispatch.dylib 0x00007fff516ad781 _dispatch_client_callout + 8
22 libdispatch.dylib 0x00007fff516afb3d _dispatch_continuation_pop + 440
23 libdispatch.dylib 0x00007fff516af209 _dispatch_async_redirect_invoke + 817
24 libdispatch.dylib 0x00007fff516bcbfc _dispatch_root_queue_drain + 350
25 libdispatch.dylib 0x00007fff516bd39e _dispatch_worker_thread2 + 99
26 libsystem_pthread.dylib 0x00007fff518d16d5 _pthread_wqthread + 220
27 libsystem_pthread.dylib 0x00007fff518d157b start_wqthread + 15
2019-11-22 05:23:06.834770+0000 SomeAppName[10379:237476] [reports] Main Thread Checker: UI API called on a background thread: -[UIViewController init]
PID: 10379, TID: 237476, Thread name: (none), Queue name: com.yannickloriot.asyncqueue, QoS: 0
Backtrace:
4 OAuthKit 0x000000010a61fc33 $sSo16UIViewControllerCABycfcTO + 19
5 OAuthKit 0x000000010a61c57f $sSo16UIViewControllerCABycfC + 31
6 OAuthKit 0x000000010a61c2be $s8OAuthKit0A8ProviderC06createA7Manager33_430562AB130E806488074CBA323B7784LL0A5Swift06OAuth2J0CyF + 1470
7 OAuthKit 0x000000010a618657 $s8OAuthKit0A8ProviderCACycfc + 775
8 OAuthKit 0x000000010a6182ec $s8OAuthKit0A8ProviderCACycfC + 60
9 SomeAppName 0x000000010a2018fb $s10SomeAppName16CoreDependenciesC13oauthProvider33_68CD4A43F5E2D568288F593D3DE6E3FCLL8OAuthKit0rG4Type_pvg + 539
10 SomeAppName 0x000000010a201c53 $s10SomeAppName16CoreDependenciesC7authSvcAA15AuthServiceType_pvg + 547
11 SomeAppName 0x000000010a202230 $s10SomeAppName16CoreDependenciesCAA10DependencyA2aDP7authSvcAA15AuthServiceType_pvgTW + 16
12 SomeAppName 0x000000010a1f6b2e $s10SomeAppName15StartInteractorC14checkAuthState10PromiseKit0I0CyytGyF + 238
13 SomeAppName 0x000000010a1f6cf9 $s10SomeAppName15StartInteractorCAA0D7UseCaseA2aDP14checkAuthState10PromiseKit0K0CyytGyFTW + 9
14 SomeAppName 0x000000010a1f7517 $s10SomeAppName14StartPresenterC14checkAuthState33_A43D4EBCFE4D52FAD1D88C1B3EB067FBLLyyFyyKcfU_ + 87
15 SomeAppName 0x000000010a1f7674 $s10SomeAppName14StartPresenterC14checkAuthState33_A43D4EBCFE4D52FAD1D88C1B3EB067FBLLyyFyyKcfU_TA + 20
16 AwaitKit 0x000000010a5b53ef $ss5Error_pIegzo_ytsAA_pIegrzo_TR + 15
17 AwaitKit 0x000000010a5b5484 $ss5Error_pIegzo_ytsAA_pIegrzo_TRTA + 20
18 PromiseKit 0x000000010a881943 $sSo17OS_dispatch_queueC10PromiseKitE5async_5group3qos5flags7executeAC0D0CyxGAC13PMKNamespacerO_So0a1_b1_G0CSg8Dispatch0L3QoSVAQ0L13WorkItemFlagsVxyKctlFyycfU_ + 275
19 PromiseKit 0x000000010a856bcd $sIeg_IeyB_TR + 45
20 libdispatch.dylib 0x00007fff516ba274 _dispatch_block_async_invoke2 + 83
21 libdispatch.dylib 0x00007fff516ad781 _dispatch_client_callout + 8
22 libdispatch.dylib 0x00007fff516afb3d _dispatch_continuation_pop + 440
23 libdispatch.dylib 0x00007fff516af209 _dispatch_async_redirect_invoke + 817
24 libdispatch.dylib 0x00007fff516bcbfc _dispatch_root_queue_drain + 350
25 libdispatch.dylib 0x00007fff516bd39e _dispatch_worker_thread2 + 99
26 libsystem_pthread.dylib 0x00007fff518d16d5 _pthread_wqthread + 220
27 libsystem_pthread.dylib 0x00007fff518d157b start_wqthread + 15
(lldb)
The only way around this for now is to disable the main thread checker in my test scheme, which I'd rather not do. I'm a little confused as to why this is happening and how to fix it.
It looks like based on the call stack OAuthKit is using a UIViewController, perhaps make sure when work is being done by OAuthKit (It's probably trying to bring up view for OAuth) that you call those functions on the main thread.