# UI API called on a background thread

**URL:** <https://devforum.zoom.us/t/ui-api-called-on-a-background-thread/7184>\
**Category:** iOS\
**Created:** [December 23, 2019, 3:24pm UTC](https://devforum.zoom.us/t/ui-api-called-on-a-background-thread/7184 "2019-12-23T15:24:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Semireg](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@Semireg](https://devforum.zoom.us/u/Semireg)\
**Post date:** [December 23, 2019, 3:24pm UTC](https://devforum.zoom.us/t/ui-api-called-on-a-background-thread/7184/1 "2019-12-23T15:24:08Z")

</div>

**Description**  
After joining a meeting and sharing a view on iOS the console prints messages about the UI API being called on a background thread.

```auto
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIView frame]
PID: 4268, TID: 3456833, Thread name: (none), Queue name: us.zoom.timerqueue, QoS: 0
Backtrace:
4 MobileRTC 0x0000000109ddd0dc _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 10945636
5 MobileRTC 0x0000000109ddc4bc _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 10942532
6 MobileRTC 0x0000000109ddc70c _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 10943124
7 MobileRTC 0x0000000109ddcdf0 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 10944888
8 libdispatch.dylib 0x000000010abb8c78 _dispatch_client_callout + 16
9 libdispatch.dylib 0x000000010abbbffc _dispatch_continuation_pop + 524
10 libdispatch.dylib 0x000000010abce610 _dispatch_source_invoke + 1444
11 libdispatch.dylib 0x000000010abc0a4c _dispatch_lane_serial_drain + 288
12 libdispatch.dylib 0x000000010abc18b4 _dispatch_lane_invoke + 456
13 libdispatch.dylib 0x000000010abcb77c _dispatch_workloop_worker_thread + 1148
14 libsystem_pthread.dylib 0x00000002098c6114 _pthread_wqthread + 304
15 libsystem_pthread.dylib 0x00000002098c8cd4 start_wqthread + 4

```

**Which version?**  
Latest version as of writing: v4.4.57220.1211

**To Reproduce(If applicable)**  
Join a meeting. Share a view.

I have tried to mitigate the issue by wrapping MobileRTCMeetingServiceDelegate callbacks (onMeetingStateChange/onMeetingReady) with DispatchQueue.main.async. Even with this, the app still suffers from the threading warnings.

**Smartphone (please complete the following information):**

- Device: iPhone 7
- OS: 12.14.1

---

<div class="post-metadata">

**Author:** ![Murray\_Li](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/murray_li/32/58_2.png) [@Murray\_Li](https://devforum.zoom.us/u/Murray_Li)\
**Post date:** [December 24, 2019, 1:53am UTC](https://devforum.zoom.us/t/ui-api-called-on-a-background-thread/7184/2 "2019-12-24T01:53:27Z")

</div>

Hi  
Yes, we have the Main Thread Checker when shared view, our colleagues in charge of the share module have not been able to change this problem, we will optimize this problem in the feature version, you can not check the “Main Thread Checker” option in the “Edit scheme-\> Diagnostics”.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/b/bdd1fc919dd553376880a7368294226f65e064f4.jpeg)  
Ths

---

<div class="post-metadata">

**Author:** ![usman.awan](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/usman.awan/32/27694_2.png) [@usman.awan](https://devforum.zoom.us/u/usman.awan)\
**Post date:** [April 14, 2020, 10:47am UTC](https://devforum.zoom.us/t/ui-api-called-on-a-background-thread/7184/3 "2020-04-14T10:47:13Z")

</div>

I am also having the same problem with the latest Zoom iOS SDK.

**Description:**

When I tried sharing the local content than when `onSinkShareSizeChange(_:)` method called than I do get the following error in the console:

```
[reports] Main Thread Checker: UI API called on a background thread: -[UIView frame]
PID: 1586, TID: 686205, Thread name: (none), Queue name: us.zoom.timerqueue, QoS: 0
Backtrace:
4 MobileRTC 0x0000000102509ba0 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14292396
5 MobileRTC 0x0000000102508f78 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14289284
6 MobileRTC 0x00000001025091c8 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14289876
7 MobileRTC 0x00000001025098b4 _Z16TermSBPTUIModulePN3Cmm22ICmmMessageQueueClientE + 14291648
8 libdispatch.dylib 0x0000000101577730 _dispatch_client_callout + 16
9 libdispatch.dylib 0x000000010157a390 _dispatch_continuation_pop + 524
10 libdispatch.dylib 0x000000010158d614 _dispatch_source_invoke + 1412
11 libdispatch.dylib 0x000000010157e588 _dispatch_lane_serial_drain + 304
12 libdispatch.dylib 0x000000010157f2e0 _dispatch_lane_invoke + 444
13 libdispatch.dylib 0x000000010158a6c4 _dispatch_workloop_worker_thread + 1304
14 libsystem_pthread.dylib 0x00000001b3321b74 _pthread_wqthread + 272
15 libsystem_pthread.dylib 0x00000001b3324740 start_wqthread + 8

```

**Which Version?**  
4.6.15084.0206

**Device and OS info?**  
iPad Air 2 (running iOS 13.4)  
iPhone X (running iOS 13.4)

---

<div class="post-metadata">

**Author:** ![carson.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/carson.zoom/32/785_2.png) [@carson.zoom](https://devforum.zoom.us/u/carson.zoom)\
**Post date:** [April 16, 2020, 11:42pm UTC](https://devforum.zoom.us/t/ui-api-called-on-a-background-thread/7184/4 "2020-04-16T23:42:47Z")

</div>

Hi [usman.awan](https://devforum.zoom.us/u/usman.awan),

Thanks for the info. Are you getting this with Zoom default UI or Custom UI? Are you using any 3rd party libraries such as MWPhotoBrowser?

Thanks!

---

<div class="post-metadata">

**Author:** ![usman.awan](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/usman.awan/32/27694_2.png) [@usman.awan](https://devforum.zoom.us/u/usman.awan)\
**Post date:** [April 17, 2020, 7:58am UTC](https://devforum.zoom.us/t/ui-api-called-on-a-background-thread/7184/5 "2020-04-17T07:58:11Z")

</div>

Hi @carson.zoom,

I am getting this in Zoom Custom UI in the sample application. This issue happens when I start the `app share` locally and on participants side, it started the screen share after the certain delay of (10-15sec).

I got this following exception:

 ![Screenshot 2020-04-17 at 2.30.16 PM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/8/803ade97e443f7e2f55b243fa7213a37bd6b60a1.jpeg)

I am unable to trace when the UI is accessed in the background thread. However, I think it’s happening when the [UIView frame] is initialized or fetched while the screen share size is changed.

---

<div class="post-metadata">

**Author:** ![carson.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/carson.zoom/32/785_2.png) [@carson.zoom](https://devforum.zoom.us/u/carson.zoom)\
**Post date:** [April 17, 2020, 11:15pm UTC](https://devforum.zoom.us/t/ui-api-called-on-a-background-thread/7184/6 "2020-04-17T23:15:47Z")

</div>

Thanks for the info. I will forward this to the engineering team for further investigation. Will get back to you shortly.

Thanks!

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [August 21, 2020, 8:15pm UTC](https://devforum.zoom.us/t/ui-api-called-on-a-background-thread/7184/7 "2020-08-21T20:15:00Z")

</div>

Closed on August 21, 2020, 8:15pm UTC


