1

I'm using SinchRTC 3.11.1 in my IOS App. When I enter a video chat the following warnings are being produced because of the Sinch library. A few UI API calls are being done from a background thread instead of the main UI thread. Can these be fixed within the library?

Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 96751, TID: 7066961, Thread name: Sinch Worker Thread, Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4   XXXXXX                    0x0000000105d7eb41 -[SINClientImpl onPubSubSubscriptionConnectionEvent] + 66
5   XXXXXX                    0x0000000105d7ec84 -[SINClientImpl onPubSubSubscriptionSuccess:] + 197
6   CoreFoundation                      0x0000000108740a3c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
7   CoreFoundation                      0x000000010874093a _CFXRegistrationPost + 442
8   CoreFoundation                      0x0000000108740682 ___CFXNotificationPost_block_invoke + 50
9   CoreFoundation                      0x0000000108702a02 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1826
10  CoreFoundation                      0x0000000108701b7c _CFXNotificationPost + 652
11  Foundation                          0x0000000109ec0172 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
12  XXXXXX                    0x0000000105d9b8c7 -[SINPubSubscriber notify:userInfo:] + 336
13  XXXXXX                    0x0000000105d9ba46 -[SINPubSubscriber subscribeDidSucceedOnChannel:sequence:withRequestedTimetoken:] + 220
14  XXXXXX                    0x0000000105d92515 -[PubnubSubscriber request:withInitialTimeToken:didSucceedWithResponse:] + 435
15  XXXXXX                    0x0000000105d920d5 __43-[PubnubSubscriber subscribeWithTimeToken:]_block_invoke + 111
16  XXXXXX                    0x0000000105d909ce __52-[PubnubService performRequest:onSuccess:onFailure:]_block_invoke.42 + 143
17  XXXXXX                    0x0000000105d8ffc9 -[PubnubRequestOperation operationWillFinish] + 284
18  XXXXXX                    0x0000000105d6902d -[SINQRunLoopOperation finishWithError:] + 70
19  XXXXXX                    0x0000000105d68536 -[SINQHTTPOperation finishWithError:] + 41
20  CFNetwork                           0x0000000107f7e0e5 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 53
21  CFNetwork                           0x0000000107f7e00a -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 198
22  CFNetwork                           0x0000000107f7df32 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 48
23  CFNetwork                           0x0000000107f823b3 ___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke + 100
24  CFNetwork                           0x00000001081283cb ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 100
25  libdispatch.dylib                   0x0000000110e8a658 _dispatch_client_callout + 8
26  libdispatch.dylib                   0x0000000110e8fe6b _dispatch_block_invoke_direct + 589
27  CFNetwork                           0x0000000107f7de04 _ZN19RunloopBlockContext13_invoke_blockEPKvPv + 24
28  CoreFoundation                      0x00000001086f35d8 CFArrayApplyFunction + 72
29  CFNetwork                           0x0000000107f7dcda _ZN19RunloopBlockContext7performEv + 132
30  CFNetwork                           0x0000000107f7db78 _ZN17MultiplexerSource7performEv + 282
31  CFNetwork                           0x0000000107f7d9ab _ZN17MultiplexerSource8_performEPv + 65
32  CoreFoundation                      0x0000000108747e71 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
33  CoreFoundation                      0x000000010872c56f __CFRunLoopDoSources0 + 271
34  CoreFoundation                      0x000000010872bb1f __CFRunLoopRun + 1039
35  CoreFoundation                      0x000000010872b499 CFRunLoopRunSpecific + 409
36  Foundation                          0x0000000109eda22e -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 274
37  XXXXXX                    0x0000000105cf8bd8 _ZN4base20MessagePumpNSRunLoop2017-07-12 12:20:51.360149-0700 XXXXXX[96751:7066961] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 96751, TID: 7066961, Thread name: Sinch Worker Thread, Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4   XXXXXX                    0x0000000105d7eb41 -[SINClientImpl onPubSubSubscriptionConnectionEvent] + 66
5   XXXXXX                    0x0000000105d7ec84 -[SINClientImpl onPubSubSubscriptionSuccess:] + 197
6   CoreFoundation                      0x0000000108740a3c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
7   CoreFoundation                      0x000000010874093a _CFXRegistrationPost + 442
8   CoreFoundation                      0x0000000108740682 ___CFXNotificationPost_block_invoke + 50
9   CoreFoundation                      0x0000000108702a02 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1826
10  CoreFoundation                      0x0000000108701b7c _CFXNotificationPost + 652
11  Foundation                          0x0000000109ec0172 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
12  XXXXXX                    0x0000000105d9b8c7 -[SINPubSubscriber notify:userInfo:] + 336
13  XXXXXX                    0x0000000105d9ba46 -[SINPubSubscriber subscribeDidSucceedOnChannel:sequence:withRequestedTimetoken:] + 220
14  XXXXXX                    0x0000000105d92515 -[PubnubSubscriber request:withInitialTimeToken:didSucceedWithResponse:] + 435
15  XXXXXX                    0x0000000105d920d5 __43-[PubnubSubscriber subscribeWithTimeToken:]_block_invoke + 111
16  XXXXXX                    0x0000000105d909ce __52-[PubnubService performRequest:onSuccess:onFailure:]_block_invoke.42 + 143
17  XXXXXX                    0x0000000105d8ffc9 -[PubnubRequestOperation operationWillFinish] + 284
18  XXXXXX                    0x0000000105d6902d -[SINQRunLoopOperation finishWithError:] + 70
19  XXXXXX                    0x0000000105d68536 -[SINQHTTPOperation finishWithError:] + 41
20  CFNetwork                           0x0000000107f7e0e5 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 53
21  CFNetwork                           0x0000000107f7e00a -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 198
22  CFNetwork                           0x0000000107f7df32 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 48
23  CFNetwork                           0x0000000107f823b3 ___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke + 100
24  CFNetwork                           0x00000001081283cb ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 100
25  libdispatch.dylib                   0x0000000110e8a658 _dispatch_client_callout + 8
26  libdispatch.dylib                   0x0000000110e8fe6b _dispatch_block_invoke_direct + 589
27  CFNetwork                           0x0000000107f7de04 _ZN19RunloopBlockContext13_invoke_blockEPKvPv + 24
28  CoreFoundation                      0x00000001086f35d8 CFArrayApplyFunction + 72
29  CFNetwork                           0x0000000107f7dcda _ZN19RunloopBlockContext7performEv + 132
30  CFNetwork                           0x0000000107f7db78 _ZN17MultiplexerSource7performEv + 282
31  CFNetwork                           0x0000000107f7d9ab _ZN17MultiplexerSource8_performEPv + 65
32  CoreFoundation                      0x0000000108747e71 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
33  CoreFoundation                      0x000000010872c56f __CFRunLoopDoSources0 + 271
34  CoreFoundation                      0x000000010872bb1f __CFRunLoopRun + 1039
35  CoreFoundation                      0x000000010872b499 CFRunLoopRunSpecific + 409
36  Foundation                          0x0000000109eda22e -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 274
37  XXXXXX                    0x0000000105cf8bd8 _ZN4base20MessagePumpNSRunLoop
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIView layer]
PID: 96751, TID: 7066464, Thread name: (none), Queue name: com.sinch.SINVideoCapturer.session, QoS: 25
Backtrace:
4   XXXXXX                    0x0000000105d66f4f -[SINVideoCapturer startWithPreset_sq:frameRate:] + 505
5   libdispatch.dylib                   0x0000000110e8966d _dispatch_call_block_and_release + 12
6   libdispatch.dylib                   0x0000000110e8a658 _dispatch_client_callout + 8
7   libdispatch.dylib                   0x0000000110e9308c _dispatch_queue_serial_drain + 1173
8   libdispatch.dylib                   0x0000000110e93aa5 _dispatch_queue_invoke + 342
9   libdispatch.dylib                   0x0000000110e96d3b _dispatch_root_queue_drain + 785
10  libdispatch.dylib                   0x0000000110e969c7 _dispatch_worker_thread4 + 54
11  libsystem_pthread.dylib             0x00000001112ed616 _pthread_wqthread + 1299
12  libsystem_pthread.dylib             0x00000001112ed0f1 start_wqthread + 13
2017-07-12 12:20:52.112965-0700 XXXXXX[96751:7066464] [reports] Main Thread Checker: UI API called on a background thread: -[UIView layer]
PID: 96751, TID: 7066464, Thread name: (none), Queue name: com.sinch.SINVideoCapturer.session, QoS: 25
Backtrace:
4   XXXXXX                    0x0000000105d66f4f -[SINVideoCapturer startWithPreset_sq:frameRate:] + 505
5   libdispatch.dylib                   0x0000000110e8966d _dispatch_call_block_and_release + 12
6   libdispatch.dylib                   0x0000000110e8a658 _dispatch_client_callout + 8
7   libdispatch.dylib                   0x0000000110e9308c _dispatch_queue_serial_drain + 1173
8   libdispatch.dylib                   0x0000000110e93aa5 _dispatch_queue_invoke + 342
9   libdispatch.dylib                   0x0000000110e96d3b _dispatch_root_queue_drain + 785
10  libdispatch.dylib                   0x0000000110e969c7 _dispatch_worker_thread4 + 54
11  libsystem_pthread.dylib             0x00000001112ed616 _pthread_wqthread + 1299
12  libsystem_pthread.dylib             0x00000001112ed0f1 start_wqthread + 13
Plo
  • 11
  • 2

2 Answers2

0

That is because Xcode 9 features a new main thread checker that checks whether UI API's are executed in Main thread. UI operations are bound to cause problems in a non-main thread. You have to update your SinchRTC to fix this runtime issue. The developers of SinchRTC should patch this and release an update. Hope this helps. For more info., refer this link.

badhanganesh
  • 3,427
  • 3
  • 18
  • 39
0

The library should fix theses errors but if you want to disable it you can do it in the scheme, in the Diagnostics option.

Example

93sauu
  • 3,770
  • 3
  • 27
  • 43