# Application Window Share - UI API called on a background thread

**URL:** <https://devforum.zoom.us/t/application-window-share-ui-api-called-on-a-background-thread/59050>\
**Category:** macOS\
**Created:** [October 18, 2021, 9:28pm UTC](https://devforum.zoom.us/t/application-window-share-ui-api-called-on-a-background-thread/59050 "2021-10-18T21:28:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![KieranAC](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kieranac/32/35367_2.png) [@KieranAC](https://devforum.zoom.us/u/KieranAC)\
**Post date:** [October 18, 2021, 9:28pm UTC](https://devforum.zoom.us/t/application-window-share-ui-api-called-on-a-background-thread/59050/1 "2021-10-18T21:28:56Z")

</div>

**Description**  
Calling ‘startAppShare’ with valid windowID causes a main thread access error with main thread checker turned on.

The API in question:

- (ZoomSDKError)startAppShare:(CGWindowID)windowID;

My usage:  
[asController startAppShare:windowID.unsignedIntValue];

Caller is calling from the main thread  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/3/b/3bcdbbcdd168cab585ab268197dea5cf6e32f724.png)

**Which macOS Meeting SDK version?**  
MacOS: 11.6  
Zoom SDK: 5.7.6.1333

**To Reproduce(If applicable)**  
Steps to reproduce the behavior:

1. Enable main thread checker  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/3/e/3ee0a467feabe3eb85aa9c6764ba50d4a5a69487.png)
2. Call startAppShare:windowID.unsignedIntValue with a valid window ID from the main thread

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

- Device: Macbook Pro 13 M1
- OS: 11.6

**Additional context**  
The window ID I am passing is fine, and the functionality works. This error is thrown and it doesn’t have an impact, but is occurring the **first time** application share occurs. Note: Subsequent shares doesn’t seem to cause the issue. (ie. start / stop / start again - only see error first time)

Here is the error in full:

=================================================================  
Main Thread Checker: UI API called on a background thread: -[NSWindow windowNumber]  
PID: 22676, TID: 4289696, Thread name: capture thread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0  
Backtrace:  
4 nydus 0x0000000110fa0ac8 nydus + 166600  
5 nydus 0x0000000110f90a68 nydus + 100968  
6 nydus 0x0000000110f90e44 nydus + 101956  
7 nydus 0x0000000110f88cd0 nydus + 68816  
8 nydus 0x0000000110f8e454 nydus + 91220  
9 nydus 0x0000000110f8e1c8 nydus + 90568  
10 CoreFoundation 0x000000018c0a0b84 \_\_CFMessagePortPerform + 600  
11 CoreFoundation 0x000000018bff5f28 **CFRUNLOOP\_IS\_CALLING\_OUT\_TO\_A\_SOURCE1\_PERFORM\_FUNCTION** + 60  
12 CoreFoundation 0x000000018bff5de4 \_\_CFRunLoopDoSource1 + 596  
13 CoreFoundation 0x000000018bff4264 \_\_CFRunLoopRun + 2372  
14 CoreFoundation 0x000000018bff31a8 CFRunLoopRunSpecific + 600  
15 nydus 0x0000000110f8da08 nydus + 88584  
16 nydus 0x0000000110f827b0 nydus + 42928  
17 libsystem\_pthread.dylib 0x0000000100e57fc8 \_pthread\_start + 320  
18 libsystem\_pthread.dylib 0x0000000100e52a78 thread\_start + 8

2021-10-18 14:16:54.963458-0700 aircover[22676:4289696] [reports] Main Thread Checker: UI API called on a background thread: -[NSWindow windowNumber]  
PID: 22676, TID: 4289696, Thread name: capture thread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0  
Backtrace:  
4 nydus 0x0000000110fa0ac8 nydus + 166600  
5 nydus 0x0000000110f90a68 nydus + 100968  
6 nydus 0x0000000110f90e44 nydus + 101956  
7 nydus 0x0000000110f88cd0 nydus + 68816  
8 nydus 0x0000000110f8e454 nydus + 91220  
9 nydus 0x0000000110f8e1c8 nydus + 90568  
10 CoreFoundation 0x000000018c0a0b84 \_\_CFMessagePortPerform + 600  
11 CoreFoundation 0x000000018bff5f28 **CFRUNLOOP\_IS\_CALLING\_OUT\_TO\_A\_SOURCE1\_PERFORM\_FUNCTION** + 60  
12 CoreFoundation 0x000000018bff5de4 \_\_CFRunLoopDoSource1 + 596  
13 CoreFoundation 0x000000018bff4264 \_\_CFRunLoopRun + 2372  
14 CoreFoundation 0x000000018bff31a8 CFRunLoopRunSpecific + 600  
15 nydus 0x0000000110f8da08 nydus + 88584  
16 nydus 0x0000000110f827b0 nydus + 42928  
17 libsystem\_pthread.dylib 0x0000000100e57fc8 \_pthread\_start + 320  
18 libsystem\_pthread.dylib 0x0000000100e52a78 thread\_start + 8

---

<div class="post-metadata">

**Author:** ![jon.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon.zoom/32/13495_2.png) [@jon.zoom](https://devforum.zoom.us/u/jon.zoom)\
**Post date:** [October 19, 2021, 10:56pm UTC](https://devforum.zoom.us/t/application-window-share-ui-api-called-on-a-background-thread/59050/2 "2021-10-19T22:56:28Z")

</div>

Hi @KieranAC, thanks for the post.

Are you able to reproduce this in the SDK sample app, or does in only occur in your own application?

Thanks!

---

<div class="post-metadata">

**Author:** ![KieranAC](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kieranac/32/35367_2.png) [@KieranAC](https://devforum.zoom.us/u/KieranAC)\
**Post date:** [October 19, 2021, 11:20pm UTC](https://devforum.zoom.us/t/application-window-share-ui-api-called-on-a-background-thread/59050/3 "2021-10-19T23:20:17Z")

</div>

The sample app does not have the ability to share specific windows - only full desktop.

The problem does not happen in full desktop share.

Also this API call is very basic (just passing an integer) and I confirmed that I was calling from the main thread in my app, so I expect the sample app will have the same issue.

I was not able to find Zoom SDK logs after enabling them either.

---

<div class="post-metadata">

**Author:** ![jon.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon.zoom/32/13495_2.png) [@jon.zoom](https://devforum.zoom.us/u/jon.zoom)\
**Post date:** [October 21, 2021, 4:44pm UTC](https://devforum.zoom.us/t/application-window-share-ui-api-called-on-a-background-thread/59050/4 "2021-10-21T16:44:13Z")

</div>

Hi @KieranAC,

You are correct that the sample app does not support sharing specific windows, so it would be necessary to slightly modify the existing share logic in order to test this. It is definitely possible that you will see the same behavior in the sample app, but either way this will help us rule out a number of variables.

> I was not able to find Zoom SDK logs after enabling them either.

I don’t think we will need the SDK logs just yet. If we get to that point, we can certainly look into why you aren’t seeing them. 🙂

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [November 21, 2021, 2:44am UTC](https://devforum.zoom.us/t/application-window-share-ui-api-called-on-a-background-thread/59050/5 "2021-11-21T02:44:49Z")

</div>

Closed on November 21, 2021, 2:44am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
