Hi,
We are experiencing an issue with zoom code that I am wondering if you can help with. I cannot attach pictures so had to copy and paste the code, so I apologize if it looks a little strange. Here are the details directly from our developer:
When I try the run the following code via a touch gesture which calls the flipCamera() below:
@objc private func flipCamera() {
DispatchQueue.global(qos: .userInitiated).async {
ZoomVideoSDK.shareInstance()?.getVideoHelper()?.switchCamera()
}
}
The camera flips but the SDK throws the error below. There seems to be some error related to UIApplication statusBarOrientation. Xcode shows the following error on the same switchCamera line: “-[UIApplication statusBarOrientation] must be used from main thread only”
Main Thread Checker: UI API called on a background thread: -[UIApplication statusBarOrientation]
PID: 13905, TID: 2430792, Thread name: (none), Queue name: com.apple.root.user-initiated-qos, QoS: 25
Backtrace:
4 ZoomVideoSDK 0x000000010d10ec34 ZoomVideoSDK + 76852
5 ZoomVideoSDK 0x000000010d10f664 ZoomVideoSDK + 79460
6 ZoomVideoSDK 0x000000010d102258 ZoomVideoSDK + 25176
7 Petzey.debug.dylib 0x0000000107110f18 $s6Petzey30ConsultationMainViewControllerC10flipCamera33_5E46F61A6B5CE48BCF8324C8B492A7E1LLyyFyyYbcfU_ + 336
8 Petzey.debug.dylib 0x00000001070dca6c $sIegh_IeyBh_TR + 48
9 libdispatch.dylib 0x00000001051e0598 _dispatch_call_block_and_release + 32
10 libdispatch.dylib 0x00000001051e204c _dispatch_client_callout + 20
11 libdispatch.dylib 0x00000001051f669c _dispatch_root_queue_drain + 972
12 libdispatch.dylib 0x00000001051f6e64 _dispatch_worker_thread2 + 196
13 libsystem_pthread.dylib 0x0000000226c00dbc _pthread_wqthread + 228
14 libsystem_pthread.dylib 0x0000000226c00b98 start_wqthread + 8
2025-03-06 19:21:55.036972+0300 Petzey[13905:2430792] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication statusBarOrientation]
PID: 13905, TID: 2430792, Thread name: (none), Queue name: com.apple.root.user-initiated-qos, QoS: 25
Backtrace:
4 ZoomVideoSDK 0x000000010d10ec34 ZoomVideoSDK + 76852
5 ZoomVideoSDK 0x000000010d10f664 ZoomVideoSDK + 79460
6 ZoomVideoSDK 0x000000010d102258 ZoomVideoSDK + 25176
7 Petzey.debug.dylib 0x0000000107110f18 $s6Petzey30ConsultationMainViewControllerC10flipCamera33_5E46F61A6B5CE48BCF8324C8B492A7E1LLyyFyyYbcfU_ + 336
8 Petzey.debug.dylib 0x00000001070dca6c $sIegh_IeyBh_TR + 48
9 libdispatch.dylib 0x00000001051e0598 _dispatch_call_block_and_release + 32
10 libdispatch.dylib 0x00000001051e204c _dispatch_client_callout + 20
11 libdispatch.dylib 0x00000001051f669c _dispatch_root_queue_drain + 972
12 libdispatch.dylib 0x00000001051f6e64 _dispatch_worker_thread2 + 196
13 libsystem_pthread.dylib 0x0000000226c00dbc _pthread_wqthread + 228
14 libsystem_pthread.dylib 0x0000000226c00b98 start_wqthread + 8
I move the call to the main thread, using the code below.
@objc private func flipCamera() {
DispatchQueue.main.async {
ZoomVideoSDK.shareInstance()?.getVideoHelper()?.switchCamera()
}
}
I get the warning from xcode: “-[AVCaptureSession startRunning] should be called from background thread. Calling it on the main thread can lead to UI unresponsiveness”. I also see the following stack trace seen below:
2025-03-06 19:40:27.894900+0300 Petzey[13948:2438125] [tcp] tcp_input [C15.1.1.1:3] flags=[R] seq=4100424357, ack=0, win=0 state=CLOSING rcv_nxt=4100424357, snd_una=3281410810
Thread Performance Checker: -[AVCaptureSession startRunning] should be called from background thread. Calling it on the main thread can lead to UI unresponsiveness
PID: 13948, TID: 2436914
Backtrace
=================================================================
22 Petzey.debug.dylib 0x0000000103358df8 $s6Petzey30ConsultationMainViewControllerC10flipCamera33_5E46F61A6B5CE48BCF8324C8B492A7E1LLyyFyyScMYccfU_ + 180
23 Petzey.debug.dylib 0x00000001030f69f4 $sIeg_IeyB_TR + 48
24 libdispatch.dylib 0x0000000101428598 _dispatch_call_block_and_release + 32
25 libdispatch.dylib 0x000000010142a04c _dispatch_client_callout + 20
26 libdispatch.dylib 0x000000010143a800 _dispatch_main_queue_drain + 1196
27 libdispatch.dylib 0x000000010143a344 _dispatch_main_queue_callback_4CF + 44
28 CoreFoundation 0x00000001da372a08 42C5C917-0447-3995-B50F-DE4D132C2435 + 633352
29 CoreFoundation 0x00000001da354368 42C5C917-0447-3995-B50F-DE4D132C2435 + 508776
30 CoreFoundation 0x00000001da3591e4 CFRunLoopRunSpecific + 612
31 GraphicsServices 0x0000000213179368 GSEventRunModal + 164
32 UIKitCore 0x00000001dc808d88 7B942FA4-CB76-3375-9972-F58C14492FB4 + 3812744
33 UIKitCore 0x00000001dc8089ec UIApplicationMain + 340
34 libswiftUIKit.dylib 0x00000001e2cb82a0 $s5UIKit17UIApplicationMainys5Int32VAD_SpySpys4Int8VGGSgSSSgAJtF + 104
35 Petzey.debug.dylib 0x00000001031a3e2c $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 120
36 Petzey.debug.dylib 0x00000001031a3da4 $s6Petzey11AppDelegateC5$mainyyFZ + 44
37 Petzey.debug.dylib 0x00000001031a4ca8 __debug_main_executable_dylib_entry_point + 28
38 dyld 0x00000001f867d948 341BBF64-6034-357E-8AA6-E1E4B988E03C + 88392
How would i run this without getting the exceptions seen. Seems like running it on the main or background threads have issues. I’m running this on ZoomVideoSDK iOS version 2.1. Your help will be appreciated.
Thank you,