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

Xcode 9 Main Thread Checker warnings #56

Open
phucnm opened this issue Oct 26, 2017 · 3 comments
Open

Xcode 9 Main Thread Checker warnings #56

phucnm opened this issue Oct 26, 2017 · 3 comments

Comments

@phucnm
Copy link

phucnm commented Oct 26, 2017

I notice that when I enable Main Thread Checker in Xcode 9, I see these warnings when GetAppController() method in UnityAppController.h is called.

Calling UI API from another thread rather than Main thread more or less cause some lags in the UI drawing I believe. Does anyone suggest a good way to fix this ?

Thanks in advanced.

Here's full log:

2017-10-26 11:57:16.365031+0700 nexus[3836:955175] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication delegate]
PID: 3836, TID: 955175, Thread name: (none), Queue name: NSOperationQueue 0x1c4e3ee00 (QOS: UNSPECIFIED), QoS: 0
Backtrace:
4   nexus                               0x000000010083cf04 UnityCurrentOrientation + 64
5   nexus                               0x00000001015debac _Z20UnityReorientVector3fff + 36
6   nexus                               0x00000001015deaa4 __UnityCoreMotionStart_block_invoke + 292
7   Foundation                          0x0000000183e72310 <redacted> + 16
8   Foundation                          0x0000000183db29e4 <redacted> + 72
9   Foundation                          0x0000000183da2620 <redacted> + 848
10  libdispatch.dylib                   0x000000010f10545c _dispatch_client_callout + 16
11  libdispatch.dylib                   0x000000010f111b74 _dispatch_block_invoke_direct + 268
12  libdispatch.dylib                   0x000000010f10545c _dispatch_client_callout + 16
13  libdispatch.dylib                   0x000000010f111b74 _dispatch_block_invoke_direct + 268
14  libdispatch.dylib                   0x000000010f111a34 dispatch_block_perform + 104
15  Foundation                          0x0000000183e73fe8 <redacted> + 376
16  libdispatch.dylib                   0x000000010f10545c _dispatch_client_callout + 16
17  libdispatch.dylib                   0x000000010f112800 _dispatch_continuation_pop + 592
18  libdispatch.dylib                   0x000000010f11109c _dispatch_async_redirect_invoke + 628
19  libdispatch.dylib                   0x000000010f116b54 _dispatch_root_queue_drain + 616
20  libdispatch.dylib                   0x000000010f116880 _dispatch_worker_thread3 + 136
21  libsystem_pthread.dylib             0x00000001830d3130 _pthread_wqthread + 1268
22  libsystem_pthread.dylib             0x00000001830d2c30 start_wqthread + 4
@basiralam
Copy link

basiralam commented Jan 29, 2018

I am facing the similar warnings:

Main Thread Checker: UI API called on a background thread: -[UIApplication delegate]
PID: 12605, TID: 2082348, Thread name: (none), Queue name: NSOperationQueue 0x1c42368c0 (QOS: UNSPECIFIED), QoS: 0
Backtrace:
4   TestUnity                    0x0000000100b7b65c UnityCurrentOrientation + 60
5   TestUnity                    0x0000000100b689e8 __UnityCoreMotionStart_block_invoke + 108
6   Foundation                          0x0000000182f36310 <redacted> + 16
7   Foundation                          0x0000000182e769e4 <redacted> + 72
8   Foundation                          0x0000000182e66620 <redacted> + 848
9   libdispatch.dylib                   0x0000000181ef1048 <redacted> + 16
10  libdispatch.dylib                   0x0000000181ef86c8 <redacted> + 288
11  libdispatch.dylib                   0x0000000181ef1048 <redacted> + 16
12  libdispatch.dylib                   0x0000000181ef86c8 <redacted> + 288
13  libdispatch.dylib                   0x0000000181ef8574 <redacted> + 104
14  Foundation                          0x0000000182f37fe8 <redacted> + 376
15  libdispatch.dylib                   0x0000000181ef1048 <redacted> + 16
16  libdispatch.dylib                   0x0000000181ef93d4 <redacted> + 428
17  libdispatch.dylib                   0x0000000181ef7cd4 <redacted> + 604
18  libdispatch.dylib                   0x0000000181efe1c8 <redacted> + 596
19  libdispatch.dylib                   0x0000000181efdf10 <redacted> + 120
20  libsystem_pthread.dylib             0x0000000182197130 _pthread_wqthread + 1268
21  libsystem_pthread.dylib             0x0000000182196c30 start_wqthread + 4

@piechart
Copy link

piechart commented Jun 7, 2018

Did anybody managed to solve this? Also faced that warning

UPD: ok, I used a dirty trick to overcome this issue by searing for GetAppController() and wrap this line to dispatch_async(dispatch_get_main_queue(), ^{ });
In mostly all UIViewController lifecycle methods and a few starting extern "C" as if you add this wrap everywhere, you're good to get yet another crash
Main thread checker warning has gone

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

3 participants