iOS开发杂货铺

iOS-Xcode9出现Main Thread Checker:

2017-10-12  本文已影响249人  malgee

最近Xcode升级,之前的程序出现了一个控制台打印问题

Main Thread Checker: UI API called on a background thread: -[UIApplication currentUserNotificationSettings]
PID: 1025, TID: 574783, Thread name: org.hxhg.jiguang.thread, Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4   Medically                           0x00000001008d1490 -[JPUSHAPNSStateReport init] + 232
5   Medically                           0x00000001008d5230 -[JPUSHClientController UDPReportAPNSState] + 44
6   Medically                           0x00000001008d4ad8 -[JPUSHClientController setup] + 484
7   Foundation                          0x000000018383fa50 <redacted> + 340
8   CoreFoundation                      0x0000000182df8358 <redacted> + 24
9   CoreFoundation                      0x0000000182df82d8 <redacted> + 88
10  CoreFoundation                      0x0000000182df7b60 <redacted> + 204
11  CoreFoundation                      0x0000000182df5738 <redacted> + 1048
12  CoreFoundation                      0x0000000182d162d8 CFRunLoopRunSpecific + 436
13  CoreFoundation                      0x0000000182d6512c CFRunLoopRun + 116
14  Medically                           0x000000010089e6ec -[JPUSHThread clientThreadMain] + 100
15  Foundation                          0x000000018383f860 <redacted> + 996
16  libsystem_pthread.dylib             0x0000000182a7c32c <redacted> + 308
17  libsystem_pthread.dylib             0x0000000182a7c1f8 <redacted> + 0
18  libsystem_pthread.dylib             0x0000000182a7ac38 thread_start + 4

上面的说的意思 程序需要在主线程执行的代码 被放在了子线程里边

对于上面 的问题给出2种解决方案


第一种
屏幕快照 2017-10-12 下午4.54.59.png
第二种
上一篇下一篇

猜你喜欢

热点阅读