极光推送iOS 开启主线程检测

mahong125
2019-04-12 07:05 1k 0

在Xcode 中开启主线程检测发现,极光推送在子线程中执行一些方法,可能会存在隐患,现将日志附上,烦请优化下。

=================================================================

```
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 29195, TID: 6968631, Thread name: org.hxhg.jiguang.thread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0
Backtrace:
4 libobjc.A.dylib 0x00000002398136f4 + 56
5 CoreLocation 0x00000002414237b8 CLClientStopVehicleHeadingUpdates + 133972
6 CoreLocation 0x00000002413fcb1c CoreLocation + 6940
7 CoreLocation 0x00000002413fd1d4 CLClientCreateWithBundleIdentifierAndPathOnRunLoop + 136
8 CoreLocation 0x00000002413fd0d8 CLClientCreateWithBundleIdentifierAndPath + 300
9 CoreLocation 0x0000000241408080 CLClientStopVehicleHeadingUpdates + 21532
10 CoreLocation 0x0000000241408864 CLClientStopVehicleHeadingUpdates + 23552
11 RBJK 0x0000000101953914 -[JCORELocationController setupLocationManager] + 108
12 RBJK 0x00000001019529e0 -[JCORELocationController initWithDelegate:] + 124
13 RBJK 0x0000000101970a28 -[JPUSHHttpSessionController init] + 204
14 RBJK 0x000000010195addc -[JPUSHNetworkController init] + 156
15 RBJK 0x0000000101954c8c -[JCOREClientController networkService] + 72
16 RBJK 0x00000001019570dc -[JCOREClientController reportSession] + 24
17 RBJK 0x0000000101954d9c -[JCOREClientController reportLaunch:] + 68
18 RBJK 0x0000000101954bb4 -[JCOREClientController setup] + 696
19 RBJK 0x000000010198b438 +[JCOREInterface setup] + 56
20 RBJK 0x00000001019b7c24 -[JPUSHClientController setup] + 148
21 libobjc.A.dylib 0x0000000239813454 + 68
22 Foundation 0x000000023b0ae234 + 340
23 CoreFoundation 0x000000023a59f954 + 28
24 CoreFoundation 0x000000023a59f8d0 + 92
25 CoreFoundation 0x000000023a59f18c + 180
26 CoreFoundation 0x000000023a599e60 + 988
27 CoreFoundation 0x000000023a599764 CFRunLoopRunSpecific + 452
28 CoreFoundation 0x000000023a59a498 CFRunLoopRun + 84
29 RBJK 0x000000010197fb18 -[JPUSHThread clientThreadMain] + 100
30 Foundation 0x000000023af78184 + 72
31 Foundation 0x000000023b0ae040 + 988
32 libsystem_pthread.dylib 0x000000023a219920 + 132
33 libsystem_pthread.dylib 0x000000023a21987c _pthread_start + 48
34 libsystem_pthread.dylib 0x000000023a221dcc thread_start + 4
`

1个回答

热门排序
  • Main Thread Checker 是xcode9之后引入的一项特性,当打开Main Thread Checker开关,检测到UI相关的操作在非主线程执行时,在某些机型上会打印以上的warning警告。这是一种警告,不一定是错误。我们的 展示全部