ScreenShare - UI API called on a background thread

Description
Hi Team,

I was able to start the meeting and screen share using Zoom iOS SDK. After starting the screen I am getting ‘UI API called on a background thread’ error. Also, participants are getting screen after 10 to 30 seconds.

Even though I am calling share method in Main Queue.

Code Snippet:

DispatchQueue.main.async {
if let ms = MobileRTC.shared().getMeetingService(){
ms.startAppShare()
ms.appShare(withView: self.view)
}
}

Error:

=================================================================
Main Thread Checker: UI API called on a background thread: -[UIView frame]
PID: 1765, TID: 634506, Thread name: (none), Queue name: us.zoom.timerqueue, QoS: 0
Backtrace:
4 MobileRTC 0x00000001049cdacc _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14942792
5 MobileRTC 0x00000001049ccea4 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14939680
6 MobileRTC 0x00000001049cd0f4 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940272
7 MobileRTC 0x00000001049cd7e0 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14942044
8 libdispatch.dylib 0x000000010575f27c _dispatch_client_callout + 20
9 libdispatch.dylib 0x0000000105762058 _dispatch_continuation_pop + 572
10 libdispatch.dylib 0x0000000105775824 _dispatch_source_invoke2 + 984
11 libdispatch.dylib 0x0000000105775114 _dispatch_source_invoke + 468
12 libdispatch.dylib 0x0000000105766740 _dispatch_lane_serial_drain + 260
13 libdispatch.dylib 0x00000001057674fc _dispatch_lane_invoke + 408
14 libdispatch.dylib 0x00000001057724dc _dispatch_workloop_worker_thread + 1344
15 libsystem_pthread.dylib 0x000000018b625a94 _pthread_wqthread + 280
16 libsystem_pthread.dylib 0x000000018b62bc7c start_wqthread + 8
2020-07-10 08:28:19.159493+0530 Power 20[1765:634506] [reports] Main Thread Checker: UI API called on a background thread: -[UIView frame]
PID: 1765, TID: 634506, Thread name: (none), Queue name: us.zoom.timerqueue, QoS: 0
Backtrace:
4 MobileRTC 0x00000001049cdacc _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14942792
5 MobileRTC 0x00000001049ccea4 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14939680
6 MobileRTC 0x00000001049cd0f4 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940272
7 MobileRTC 0x00000001049cd7e0 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14942044
8 libdispatch.dylib 0x000000010575f27c _dispatch_client_callout + 20
9 libdispatch.dylib 0x0000000105762058 _dispatch_continuation_pop + 572
10 libdispatch.dylib 0x0000000105775824 _dispatch_source_invoke2 + 984
11 libdispatch.dylib 0x0000000105775114 _dispatch_source_invoke + 468
12 libdispatch.dylib 0x0000000105766740 _dispatch_lane_serial_drain + 260
13 libdispatch.dylib 0x00000001057674fc _dispatch_lane_invoke + 408
14 libdispatch.dylib 0x00000001057724dc _dispatch_workloop_worker_thread + 1344
15 libsystem_pthread.dylib 0x000000018b625a94 _pthread_wqthread + 280
16 libsystem_pthread.dylib 0x000000018b62bc7c start_wqthread + 8

Main Thread Checker: UI API called on a background thread: -[UIView contentScaleFactor]
PID: 1765, TID: 634506, Thread name: (none), Queue name: us.zoom.timerqueue, QoS: 0
Backtrace:
4 MobileRTC 0x00000001049ce270 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14944748
5 MobileRTC 0x00000001049cd094 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940176
6 MobileRTC 0x00000001049cd1dc _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940504
7 MobileRTC 0x00000001049cd7e0 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14942044
8 libdispatch.dylib 0x000000010575f27c _dispatch_client_callout + 20
9 libdispatch.dylib 0x0000000105762058 _dispatch_continuation_pop + 572
10 libdispatch.dylib 0x0000000105775824 _dispatch_source_invoke2 + 984
11 libdispatch.dylib 0x0000000105775114 _dispatch_source_invoke + 468
12 libdispatch.dylib 0x0000000105766740 _dispatch_lane_serial_drain + 260
13 libdispatch.dylib 0x00000001057674fc _dispatch_lane_invoke + 408
14 libdispatch.dylib 0x00000001057724dc _dispatch_workloop_worker_thread + 1344
15 libsystem_pthread.dylib 0x000000018b625a94 _pthread_wqthread + 280
16 libsystem_pthread.dylib 0x000000018b62bc7c start_wqthread + 8
2020-07-10 08:28:35.637867+0530 Power 20[1765:634506] [reports] Main Thread Checker: UI API called on a background thread: -[UIView contentScaleFactor]
PID: 1765, TID: 634506, Thread name: (none), Queue name: us.zoom.timerqueue, QoS: 0
Backtrace:
4 MobileRTC 0x00000001049ce270 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14944748
5 MobileRTC 0x00000001049cd094 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940176
6 MobileRTC 0x00000001049cd1dc _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940504
7 MobileRTC 0x00000001049cd7e0 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14942044
8 libdispatch.dylib 0x000000010575f27c _dispatch_client_callout + 20
9 libdispatch.dylib 0x0000000105762058 _dispatch_continuation_pop + 572
10 libdispatch.dylib 0x0000000105775824 _dispatch_source_invoke2 + 984
11 libdispatch.dylib 0x0000000105775114 _dispatch_source_invoke + 468
12 libdispatch.dylib 0x0000000105766740 _dispatch_lane_serial_drain + 260
13 libdispatch.dylib 0x00000001057674fc _dispatch_lane_invoke + 408
14 libdispatch.dylib 0x00000001057724dc _dispatch_workloop_worker_thread + 1344
15 libsystem_pthread.dylib 0x000000018b625a94 _pthread_wqthread + 280
16 libsystem_pthread.dylib 0x000000018b62bc7c start_wqthread + 8

Main Thread Checker: UI API called on a background thread: -[UIView layer]
PID: 1765, TID: 634506, Thread name: (none), Queue name: us.zoom.timerqueue, QoS: 0
Backtrace:
4 MobileRTC 0x00000001049ce284 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14944768
5 MobileRTC 0x00000001049cd094 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940176
6 MobileRTC 0x00000001049cd1dc _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940504
7 MobileRTC 0x00000001049cd7e0 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14942044
8 libdispatch.dylib 0x000000010575f27c _dispatch_client_callout + 20
9 libdispatch.dylib 0x0000000105762058 _dispatch_continuation_pop + 572
10 libdispatch.dylib 0x0000000105775824 _dispatch_source_invoke2 + 984
11 libdispatch.dylib 0x0000000105775114 _dispatch_source_invoke + 468
12 libdispatch.dylib 0x0000000105766740 _dispatch_lane_serial_drain + 260
13 libdispatch.dylib 0x00000001057674fc _dispatch_lane_invoke + 408
14 libdispatch.dylib 0x00000001057724dc _dispatch_workloop_worker_thread + 1344
15 libsystem_pthread.dylib 0x000000018b625a94 _pthread_wqthread + 280
16 libsystem_pthread.dylib 0x000000018b62bc7c start_wqthread + 8
2020-07-10 08:28:35.769481+0530 Power 20[1765:634506] [reports] Main Thread Checker: UI API called on a background thread: -[UIView layer]
PID: 1765, TID: 634506, Thread name: (none), Queue name: us.zoom.timerqueue, QoS: 0
Backtrace:
4 MobileRTC 0x00000001049ce284 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14944768
5 MobileRTC 0x00000001049cd094 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940176
6 MobileRTC 0x00000001049cd1dc _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940504
7 MobileRTC 0x00000001049cd7e0 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14942044
8 libdispatch.dylib 0x000000010575f27c _dispatch_client_callout + 20
9 libdispatch.dylib 0x0000000105762058 _dispatch_continuation_pop + 572
10 libdispatch.dylib 0x0000000105775824 _dispatch_source_invoke2 + 984
11 libdispatch.dylib 0x0000000105775114 _dispatch_source_invoke + 468
12 libdispatch.dylib 0x0000000105766740 _dispatch_lane_serial_drain + 260
13 libdispatch.dylib 0x00000001057674fc _dispatch_lane_invoke + 408
14 libdispatch.dylib 0x00000001057724dc _dispatch_workloop_worker_thread + 1344
15 libsystem_pthread.dylib 0x000000018b625a94 _pthread_wqthread + 280
16 libsystem_pthread.dylib 0x000000018b62bc7c start_wqthread + 8

Main Thread Checker: UI API called on a background thread: -[UIView setContentScaleFactor:]
PID: 1765, TID: 634506, Thread name: (none), Queue name: us.zoom.timerqueue, QoS: 0
Backtrace:
4 MobileRTC 0x00000001049ce2a8 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14944804
5 MobileRTC 0x00000001049cd094 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940176
6 MobileRTC 0x00000001049cd1dc _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940504
7 MobileRTC 0x00000001049cd7e0 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14942044
8 libdispatch.dylib 0x000000010575f27c _dispatch_client_callout + 20
9 libdispatch.dylib 0x0000000105762058 _dispatch_continuation_pop + 572
10 libdispatch.dylib 0x0000000105775824 _dispatch_source_invoke2 + 984
11 libdispatch.dylib 0x0000000105775114 _dispatch_source_invoke + 468
12 libdispatch.dylib 0x0000000105766740 _dispatch_lane_serial_drain + 260
13 libdispatch.dylib 0x00000001057674fc _dispatch_lane_invoke + 408
14 libdispatch.dylib 0x00000001057724dc _dispatch_workloop_worker_thread + 1344
15 libsystem_pthread.dylib 0x000000018b625a94 _pthread_wqthread + 280
16 libsystem_pthread.dylib 0x000000018b62bc7c start_wqthread + 8
2020-07-10 08:28:35.889817+0530 Power 20[1765:634506] [reports] Main Thread Checker: UI API called on a background thread: -[UIView setContentScaleFactor:]
PID: 1765, TID: 634506, Thread name: (none), Queue name: us.zoom.timerqueue, QoS: 0
Backtrace:
4 MobileRTC 0x00000001049ce2a8 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14944804
5 MobileRTC 0x00000001049cd094 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940176
6 MobileRTC 0x00000001049cd1dc _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940504
7 MobileRTC 0x00000001049cd7e0 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14942044
8 libdispatch.dylib 0x000000010575f27c _dispatch_client_callout + 20
9 libdispatch.dylib 0x0000000105762058 _dispatch_continuation_pop + 572
10 libdispatch.dylib 0x0000000105775824 _dispatch_source_invoke2 + 984
11 libdispatch.dylib 0x0000000105775114 _dispatch_source_invoke + 468
12 libdispatch.dylib 0x0000000105766740 _dispatch_lane_serial_drain + 260
13 libdispatch.dylib 0x00000001057674fc _dispatch_lane_invoke + 408
14 libdispatch.dylib 0x00000001057724dc _dispatch_workloop_worker_thread + 1344
15 libsystem_pthread.dylib 0x000000018b625a94 _pthread_wqthread + 280
16 libsystem_pthread.dylib 0x000000018b62bc7c start_wqthread + 8

Main Thread Checker: UI API called on a background thread: -[UIView bounds]
PID: 1765, TID: 634506, Thread name: (none), Queue name: us.zoom.timerqueue, QoS: 0
Backtrace:
4 MobileRTC 0x00000001049ce3e4 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14945120
5 MobileRTC 0x00000001049cd094 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940176
6 MobileRTC 0x00000001049cd1dc _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940504
7 MobileRTC 0x00000001049cd7e0 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14942044
8 libdispatch.dylib 0x000000010575f27c _dispatch_client_callout + 20
9 libdispatch.dylib 0x0000000105762058 _dispatch_continuation_pop + 572
10 libdispatch.dylib 0x0000000105775824 _dispatch_source_invoke2 + 984
11 libdispatch.dylib 0x0000000105775114 _dispatch_source_invoke + 468
12 libdispatch.dylib 0x0000000105766740 _dispatch_lane_serial_drain + 260
13 libdispatch.dylib 0x00000001057674fc _dispatch_lane_invoke + 408
14 libdispatch.dylib 0x00000001057724dc _dispatch_workloop_worker_thread + 1344
15 libsystem_pthread.dylib 0x000000018b625a94 _pthread_wqthread + 280
16 libsystem_pthread.dylib 0x000000018b62bc7c start_wqthread + 8
2020-07-10 08:28:35.984150+0530 Power 20[1765:634506] [reports] Main Thread Checker: UI API called on a background thread: -[UIView bounds]
PID: 1765, TID: 634506, Thread name: (none), Queue name: us.zoom.timerqueue, QoS: 0
Backtrace:
4 MobileRTC 0x00000001049ce3e4 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14945120
5 MobileRTC 0x00000001049cd094 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940176
6 MobileRTC 0x00000001049cd1dc _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940504
7 MobileRTC 0x00000001049cd7e0 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14942044
8 libdispatch.dylib 0x000000010575f27c _dispatch_client_callout + 20
9 libdispatch.dylib 0x0000000105762058 _dispatch_continuation_pop + 572
10 libdispatch.dylib 0x0000000105775824 _dispatch_source_invoke2 + 984
11 libdispatch.dylib 0x0000000105775114 _dispatch_source_invoke + 468
12 libdispatch.dylib 0x0000000105766740 _dispatch_lane_serial_drain + 260
13 libdispatch.dylib 0x00000001057674fc _dispatch_lane_invoke + 408
14 libdispatch.dylib 0x00000001057724dc _dispatch_workloop_worker_thread + 1344
15 libsystem_pthread.dylib 0x000000018b625a94 _pthread_wqthread + 280
16 libsystem_pthread.dylib 0x000000018b62bc7c start_wqthread + 8

Main Thread Checker: UI API called on a background thread: -[UIView drawViewHierarchyInRect:afterScreenUpdates:]
PID: 1765, TID: 634506, Thread name: (none), Queue name: us.zoom.timerqueue, QoS: 0
Backtrace:
4 MobileRTC 0x00000001049ce3f8 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14945140
5 MobileRTC 0x00000001049cd094 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940176
6 MobileRTC 0x00000001049cd1dc _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940504
7 MobileRTC 0x00000001049cd7e0 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14942044
8 libdispatch.dylib 0x000000010575f27c _dispatch_client_callout + 20
9 libdispatch.dylib 0x0000000105762058 _dispatch_continuation_pop + 572
10 libdispatch.dylib 0x0000000105775824 _dispatch_source_invoke2 + 984
11 libdispatch.dylib 0x0000000105775114 _dispatch_source_invoke + 468
12 libdispatch.dylib 0x0000000105766740 _dispatch_lane_serial_drain + 260
13 libdispatch.dylib 0x00000001057674fc _dispatch_lane_invoke + 408
14 libdispatch.dylib 0x00000001057724dc _dispatch_workloop_worker_thread + 1344
15 libsystem_pthread.dylib 0x000000018b625a94 _pthread_wqthread + 280
16 libsystem_pthread.dylib 0x000000018b62bc7c start_wqthread + 8
2020-07-10 08:28:36.085066+0530 Power 20[1765:634506] [reports] Main Thread Checker: UI API called on a background thread: -[UIView drawViewHierarchyInRect:afterScreenUpdates:]
PID: 1765, TID: 634506, Thread name: (none), Queue name: us.zoom.timerqueue, QoS: 0
Backtrace:
4 MobileRTC 0x00000001049ce3f8 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14945140
5 MobileRTC 0x00000001049cd094 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940176
6 MobileRTC 0x00000001049cd1dc _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14940504
7 MobileRTC 0x00000001049cd7e0 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14942044
8 libdispatch.dylib 0x000000010575f27c _dispatch_client_callout + 20
9 libdispatch.dylib 0x0000000105762058 _dispatch_continuation_pop + 572
10 libdispatch.dylib 0x0000000105775824 _dispatch_source_invoke2 + 984
11 libdispatch.dylib 0x0000000105775114 _dispatch_source_invoke + 468
12 libdispatch.dylib 0x0000000105766740 _dispatch_lane_serial_drain + 260
13 libdispatch.dylib 0x00000001057674fc _dispatch_lane_invoke + 408
14 libdispatch.dylib 0x00000001057724dc _dispatch_workloop_worker_thread + 1344
15 libsystem_pthread.dylib 0x000000018b625a94 _pthread_wqthread + 280
16 libsystem_pthread.dylib 0x000000018b62bc7c start_wqthread + 8

Which version?
v5.0.24433.0616

Hi @pandiyaraj,

Thanks for the post and the info. Is this reproducible with our demo app? I tried to follow the steps you are mentioning and I did not encounter such issue. Could you also provide the SDK log for us to further investigate?

Thanks!

Hi @pandiyaraj

Our SDK has the main thread checker when sharing a view. Please uncheck the main thread checker in Xcode > Product > Scheme > Edit Scheme > Run > Diagnostics > Runtime API Checking > Main Thread Checker to avoid this issue.

Thanks!