# EXC\_BAD\_ACCESS error for screen sharing

**URL:** <https://devforum.zoom.us/t/exc-bad-access-error-for-screen-sharing/108107>\
**Category:** Video SDK\
**Tags:** video-sdk, ios\
**Created:** [April 18, 2024, 1:52am UTC](https://devforum.zoom.us/t/exc-bad-access-error-for-screen-sharing/108107 "2024-04-18T01:52:07Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric-gtarxr](https://avatars.discourse-cdn.com/v4/letter/e/df788c/32.png) [@eric-gtarxr](https://devforum.zoom.us/u/eric-gtarxr)\
**Post date:** [April 18, 2024, 1:52am UTC](https://devforum.zoom.us/t/exc-bad-access-error-for-screen-sharing/108107/1 "2024-04-18T01:52:07Z")

</div>

We followed the official documentation for [screen sharing with VideoSDK iOS](https://developers.zoom.us/docs/video-sdk/ios/share/)

Testing environment:

- iPad Pro 11-inch (4 - th generation): iPad OS 17.4.1
- Apple M2 Max MacBook: MacOS Ventura 13.6.6
- XCode: Version 15.2
- Zoom VideoSDK IOS: v1.10.11

we can successfully start the ScreenShare Broadcast Extensions. However, when it start broadcast, there is a **EXC\_BAD\_ACCESS** error in

`screenShareService?.processSampleBuffer(sampleBuffer, with: sampleBufferType)`

We have checked that screenShareService is not null and confirmed that the sampleBuffer and sampleBufferType are correct. It seems we can not correctly access processSampleBuffer from the screenShareService object. Any suggestion on how to solve it would be very appreciated.

---

<div class="post-metadata">

**Author:** ![boonjun.tan](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/boonjun.tan/32/38306_2.png) [@boonjun.tan](https://devforum.zoom.us/u/boonjun.tan)\
**Post date:** [August 29, 2024, 3:36am UTC](https://devforum.zoom.us/t/exc-bad-access-error-for-screen-sharing/108107/2 "2024-08-29T03:36:31Z")

</div>

Hi @eric-gtarxr,

I apologise that the screen-sharing documentation missed out on mentioning the need for zoomcml.framework. Can I check if you have added that framework to your main target and see if you still get that error? We are also updating our doc to mention that.

Cheers!

---

<div class="post-metadata">

**Author:** ![ztrehagem](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ztrehagem/32/62689_2.png) [@ztrehagem](https://devforum.zoom.us/u/ztrehagem)\
**Post date:** [August 29, 2024, 5:51am UTC](https://devforum.zoom.us/t/exc-bad-access-error-for-screen-sharing/108107/3 "2024-08-29T05:51:48Z")

</div>

I am also unable to start screen sharing in my app due to the same error.  
I was just about to post this when I saw your reply, but adding zoomcml.framework didn’t change the situation.

My environment:

- iPad 6th generation, iPadOS 17.6.1
- Xcode 15.4
- ZoomVideoSDK 1.12.10

Here is the app for repro: [GitHub - ztrehagem/ZoomVideoSDK-iOS-Sample](https://github.com/ztrehagem/ZoomVideoSDK-iOS-Sample)  
Debug logs and some lldb outputs: [ZoomVideoSDK\_2024-08-29 - Google Drive](https://drive.google.com/drive/folders/1za7nRYAXHqReBN4IR6IOIIAKra9RO1pn?usp=sharing)

Is there something I’m missing?  
Please let me know if there’s anything else you need.

Thanks.

---

<div class="post-metadata">

**Author:** ![stuart.wallace](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/stuart.wallace/32/50456_2.png) [@stuart.wallace](https://devforum.zoom.us/u/stuart.wallace)\
**Post date:** [August 29, 2024, 2:08pm UTC](https://devforum.zoom.us/t/exc-bad-access-error-for-screen-sharing/108107/4 "2024-08-29T14:08:41Z")

</div>

Same issue here! When turning on the address sanitizer it crashes with…

Thread 4: EXC\_RESOURCE (RESOURCE\_TYPE\_MEMORY: high watermark memory limit exceeded) (limit=50 MB)

---

<div class="post-metadata">

**Author:** ![boonjun.tan](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/boonjun.tan/32/38306_2.png) [@boonjun.tan](https://devforum.zoom.us/u/boonjun.tan)\
**Post date:** [September 6, 2024, 2:51am UTC](https://devforum.zoom.us/t/exc-bad-access-error-for-screen-sharing/108107/5 "2024-09-06T02:51:27Z")

</div>

Hi @ztrehagem,

Apologise of the mistake I made here. Please include CptShare.xcframework instead of zoomcml.xcframework in your main project. We have updated our screen-sharing [documentation](https://developers.zoom.us/docs/video-sdk/ios/share/) on this. For more details in all the [Zoom’s xcframeworks](https://developers.zoom.us/docs/video-sdk/ios/integrate/#feature-framework-bundles), you can refer to here.

Thank you.

---

<div class="post-metadata">

**Author:** ![boonjun.tan](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/boonjun.tan/32/38306_2.png) [@boonjun.tan](https://devforum.zoom.us/u/boonjun.tan)\
**Post date:** [September 6, 2024, 2:52am UTC](https://devforum.zoom.us/t/exc-bad-access-error-for-screen-sharing/108107/6 "2024-09-06T02:52:22Z")

</div>

Hi @stuart.wallace,

I don’t actually think this error is related to our SDK, can you please provide me with details on this crash.

Thank you.

---

<div class="post-metadata">

**Author:** ![ztrehagem](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ztrehagem/32/62689_2.png) [@ztrehagem](https://devforum.zoom.us/u/ztrehagem)\
**Post date:** [September 6, 2024, 6:54am UTC](https://devforum.zoom.us/t/exc-bad-access-error-for-screen-sharing/108107/7 "2024-09-06T06:54:52Z")

</div>

Thank you @boonjun.tan , it solved! There are no more crashes.  
But now I have another problem: the callback `onUserShareStatusChanged` is never called, so the main target has no way to know when the user starts screen sharing.  
Would it be better to create a new topic about this problem?

---

<div class="post-metadata">

**Author:** ![boonjun.tan](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/boonjun.tan/32/38306_2.png) [@boonjun.tan](https://devforum.zoom.us/u/boonjun.tan)\
**Post date:** [September 6, 2024, 7:18am UTC](https://devforum.zoom.us/t/exc-bad-access-error-for-screen-sharing/108107/8 "2024-09-06T07:18:25Z")

</div>

Hi @ztrehagem.

Great to hear that the solution resolved your crashes.

As for the callback [onUserShareStatusChanged](https://marketplacefront.zoom.us/sdk/custom/ios/_zoom_video_s_d_k_constants_8h.html#a93da6ba58178c725eadacbbb5ade59c2), we can continue with this thread here. You should indeed get this callback whenever the share status of anyone has any changes but you will first need to subscribe to the [ZoomVideoSDKDelegate](https://marketplacefront.zoom.us/sdk/custom/ios/protocol_zoom_video_s_d_k_delegate-p.html) first. Can I check that you have subscribed to this already before the screen sharing happened? If not, you can take a look at our documentation on this [here](https://developers.zoom.us/docs/video-sdk/ios/integrate/#implement-a-delegate).

Thank you.

---

<div class="post-metadata">

**Author:** ![ztrehagem](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ztrehagem/32/62689_2.png) [@ztrehagem](https://devforum.zoom.us/u/ztrehagem)\
**Post date:** [September 9, 2024, 2:29am UTC](https://devforum.zoom.us/t/exc-bad-access-error-for-screen-sharing/108107/9 "2024-09-09T02:29:20Z")

</div>

Thank you for replying @boonjun.tan .

I subscribed to the ZoomVideoSDKDelegate [here](https://github.com/ztrehagem/ZoomVideoSDK-iOS-Sample/blob/e967c923e2e280ce7f22e86455066360b7df2693/ZoomVideoSDK-iOS-Sample/Room.swift#L52-L103), so it seems that other callbacks are called correctly such as `onUserJoin` and `onUserLeave`, but `onUserShareStatusChanged` is not called.  
On the other hand, when users connecting from browsers starts screen sharing, `onUserShareStatusChanged` is called.

Should I get debug logs again?

---

<div class="post-metadata">

**Author:** ![boonjun.tan](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/boonjun.tan/32/38306_2.png) [@boonjun.tan](https://devforum.zoom.us/u/boonjun.tan)\
**Post date:** [September 9, 2024, 2:49am UTC](https://devforum.zoom.us/t/exc-bad-access-error-for-screen-sharing/108107/10 "2024-09-09T02:49:49Z")

</div>

Hi @ztrehagem,

Do you mean to say that on web screen sharing the onUserShareStatusChanged callback is triggered but it does not get triggered when iOS screen shares? Does this happen on your actual application or the sample application you have provided? I don’t need the Zoom’s log if it’s your sample app since I can download it and investigate on my end but if it’s your actual application then I will need the log.

Thank you.

---

<div class="post-metadata">

**Author:** ![ztrehagem](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ztrehagem/32/62689_2.png) [@ztrehagem](https://devforum.zoom.us/u/ztrehagem)\
**Post date:** [September 9, 2024, 3:52am UTC](https://devforum.zoom.us/t/exc-bad-access-error-for-screen-sharing/108107/11 "2024-09-09T03:52:13Z")

</div>

Thank you for your quick reply.  
Yes, I mean that. It happens on the sample application I have provided.  
Could you try to run the sample application?

---

<div class="post-metadata">

**Author:** ![ztrehagem](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ztrehagem/32/62689_2.png) [@ztrehagem](https://devforum.zoom.us/u/ztrehagem)\
**Post date:** [September 17, 2024, 5:00am UTC](https://devforum.zoom.us/t/exc-bad-access-error-for-screen-sharing/108107/12 "2024-09-17T05:00:38Z")

</div>

I communicated with the support team via email, and finally I found it is required to get ShareHelper before starting screen sharing as below.

```swift
ZoomVideoSDK.shareInstance()?.getShareHelper()

```

This makes the callback `onUserShareStatusChanged` ready to be triggered.

I will continue to implement a screen share feature to my app.
