0
Main Thread Checker: UI API called on a background thread: -[UIView setHidden:]
PID: 9947, TID: 1414260, Thread name: (none), Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4   doctor                              0x0000000100d2e80f -[LoginController load:] + 3279
5   Foundation                          0x00000001011ba8ac __NSThread__start__ + 1197
6   libsystem_pthread.dylib             0x0000000106ea16c1 _pthread_body + 340
7   libsystem_pthread.dylib             0x0000000106ea156d _pthread_body + 0
8   libsystem_pthread.dylib             0x0000000106ea0c5d thread_start + 13
2017-11-21 14:54:59.253674+0800 doctor[9947:1414260] [reports] Main Thread Checker: UI API called on a background thread: -[UIView setHidden:]
PID: 9947, TID: 1414260, Thread name: (none), Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4   doctor                              0x0000000100d2e80f -[LoginController load:] + 3279
5   Foundation                          0x00000001011ba8ac __NSThread__start__ + 1197
6   libsystem_pthread.dylib             0x0000000106ea16c1 _pthread_body + 340
7   libsystem_pthread.dylib             0x0000000106ea156d _pthread_body + 0
8   libsystem_pthread.dylib             0x0000000106ea0c5d thread_start + 13
2017-11-21 14:54:59.379571+0800 doctor[9947:1414260] This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes.
Stack:(
    0   Foundation                          0x00000001013d5ec6 _AssertAutolayoutOnAllowedThreadsOnly + 77
    1   Foundation                          0x00000001011dfd7a -[NSISEngine withBehaviors:performModifications:] + 28
    2   UIKit                               0x000000010240d9fc __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 604
    3   UIKit                               0x000000010240d778 -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 223
    4   UIKit                               0x0000000101954125 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 112
    5   UIKit                               0x0000000101954033 -[UIView(Hierarchy) _postMovedFromSuperview:] + 828
    6   UIKit                               0x000000010196494d -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1973
    7   UIKit                               0x0000000101ce3461 -[UILayoutContainerView addSubview:] + 75
    8   UIKit                               0x0000000101a76dee -[UINavigationController _unhideNavigationBarForEdge:] + 99
    9   UIKit                               0x0000000101a77098 -[UINavigationController _setNavigationBarHidden:edge:duration:] + 208
    10  UIKit                               0x0000000101a74b1e -[UINavigationController setNavigationBarHidden:animated:] + 141
    11  doctor                              0x0000000100d2e863 -[LoginController load:] + 3363
    12  Foundation                          0x00000001011ba8ac __NSThread__start__ + 1197
    13  libsystem_pthread.dylib             0x0000000106ea16c1 _pthread_body + 340
    14  libsystem_pthread.dylib             0x0000000106ea156d _pthread_body + 0
    15  libsystem_pthread.dylib             0x0000000106ea0c5d thread_start + 13
)

especially

This application is modifying the autolayout engine from a background 
thread after the engine was accessed from the main thread. This can 
lead to engine corruption and weird crashes.

this tip repeats many times, until

2017-11-21 14:56:57.993852+0800 doctor[9947:1414234] Received XPC 
error Connection interrupted for message type 3 
kCFNetworkAgentXPCMessageTypePACQuery
2017-11-21 14:56:57.994722+0800 doctor[9947:1414234] Received XPC error 
Connection invalid for message type 3 
kCFNetworkAgentXPCMessageTypePACQuery

Then app crushes, has no response. And there isn't other error messages in the console. Any way to know the crush reason and how to solve it. Thanks!

rmaddy
  • 314,917
  • 42
  • 532
  • 579
jasony
  • 3
  • 2
  • It seems like, you are updating or hiding some view in background thread. Can you check if this is the case ? If this is the case, then try to call that method in main thread. – Sushil Sharma Nov 21 '17 at 07:35
  • 1
    Possible duplicate of [This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes](https://stackoverflow.com/questions/31951704/this-application-is-modifying-the-autolayout-engine-from-a-background-thread-wh) – Sandeep Bhandari Nov 21 '17 at 07:35
  • When you compile your code in xcode9, it shows the background thread UI update error count in build progress section. Tap on it and it will open the code which has issue related to background thread. You are setting some UI hidden on background thread. Do it on main thread will solve the crash. – miOS Nov 21 '17 at 08:26
  • @miOS your solution worked for me, thanks! – jasony Nov 22 '17 at 09:19
  • @jasony Great! You are welcome – miOS Nov 22 '17 at 10:11

1 Answers1

0

Check your LoginController. There must be code like yourView.hidden = YES/NO. Change that line of code to

    dispatch_async(dispatch_get_main_queue(), ^{
         //yourView.hidden = YES;
         //or
         //yourView.hidden = NO;
    });
Torongo
  • 1,021
  • 1
  • 7
  • 14