Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updateCameraAngleForCurrentDeviceMotion calls UI API on a background thread #66

Open
jagatfx opened this issue Apr 24, 2018 · 0 comments

Comments

@jagatfx
Copy link

jagatfx commented Apr 24, 2018

When running the example project on iOS 11.3 with Xcode 9.3, the Main Thread Checker detects that the UI API is called on a background thread instead of the main thread in updateCameraAngleForCurrentDeviceMotion() and Xcode reports -[UIApplication statusBarOrientation] must be used from main thread only on https://github.com/NYTimes/ios-360-videos/blob/develop/Sources/NYT360CameraController.m#L109.

After surrounding the code block by dispatch_async(dispatch_get_main_queue(), ^{ ... }); the warning no longer appears.

Main Thread Checker: UI API called on a background thread: -[UIApplication statusBarOrientation]
PID: 6294, TID: 2952262, Thread name: (none), Queue name: com.apple.scenekit.renderingQueue.SCNView0x10bd0c930, QoS: 33
Backtrace:
4   NYT360Video                         0x00000001047c9a48 -[NYT360CameraController updateCameraAngleForCurrentDeviceMotion] + 384
5   NYT360Video                         0x00000001047c8ea8 -[NYT360ViewController renderer:updateAtTime:] + 116
6   SceneKit                            0x0000000196c5af80 <redacted> + 444
7   SceneKit                            0x0000000196c5d018 <redacted> + 252
8   SceneKit                            0x0000000196c5d69c <redacted> + 84
9   SceneKit                            0x0000000196c5daa0 <redacted> + 728
10  SceneKit                            0x0000000196d0446c <redacted> + 512
11  SceneKit                            0x0000000196bc07dc <redacted> + 56
12  SceneKit                            0x0000000196ccd388 <redacted> + 80
13  libdispatch.dylib                   0x00000001047e9260 _dispatch_call_block_and_release + 24
14  libdispatch.dylib                   0x00000001047e9220 _dispatch_client_callout + 16
15  libdispatch.dylib                   0x00000001047f7e80 _dispatch_queue_serial_drain + 768
16  libdispatch.dylib                   0x00000001047ec730 _dispatch_queue_invoke + 328
17  libdispatch.dylib                   0x00000001047f8dd8 _dispatch_root_queue_drain_deferred_wlh + 352
18  libdispatch.dylib                   0x00000001047ffebc _dispatch_workloop_worker_thread + 676
19  libsystem_pthread.dylib             0x0000000182643e70 _pthread_wqthread + 860
20  libsystem_pthread.dylib             0x0000000182643b08 start_wqthread + 4
2018-04-24 16:27:12.053023+0800 NYT360VideoExample[6294:2952262] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication statusBarOrientation]
PID: 6294, TID: 2952262, Thread name: (none), Queue name: com.apple.scenekit.renderingQueue.SCNView0x10bd0c930, QoS: 33
Backtrace:
4   NYT360Video                         0x00000001047c9a48 -[NYT360CameraController updateCameraAngleForCurrentDeviceMotion] + 384
5   NYT360Video                         0x00000001047c8ea8 -[NYT360ViewController renderer:updateAtTime:] + 116
6   SceneKit                            0x0000000196c5af80 <redacted> + 444
7   SceneKit                            0x0000000196c5d018 <redacted> + 252
8   SceneKit                            0x0000000196c5d69c <redacted> + 84
9   SceneKit                            0x0000000196c5daa0 <redacted> + 728
10  SceneKit                            0x0000000196d0446c <redacted> + 512
11  SceneKit                            0x0000000196bc07dc <redacted> + 56
12  SceneKit                            0x0000000196ccd388 <redacted> + 80
13  libdispatch.dylib                   0x00000001047e9260 _dispatch_call_block_and_release + 24
14  libdispatch.dylib                   0x00000001047e9220 _dispatch_client_callout + 16
15  libdispatch.dylib                   0x00000001047f7e80 _dispatch_queue_serial_drain + 768
16  libdispatch.dylib                   0x00000001047ec730 _dispatch_queue_invoke + 328
17  libdispatch.dylib                   0x00000001047f8dd8 _dispatch_root_queue_drain_deferred_wlh + 352
18  libdispatch.dylib                   0x00000001047ffebc _dispatch_workloop_worker_thread + 676
19  libsystem_pthread.dylib             0x0000000182643e70 _pthread_wqthread + 860
20  libsystem_pthread.dylib             0x0000000182643b08 start_wqthread + 4
maestun pushed a commit to maestun/ios-360-videos that referenced this issue Aug 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant