ios 12.1 下出現 Main Thread Checker: UI API called on a background thread


(ruru7947) #1

在12.01 跟 12.1 測試,只會在12.1出現

Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 1153, TID: 193781, Thread name: org.hxhg.jiguang.thread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0
Backtrace:
4   libobjc.A.dylib                     0x00000001809a3894 <redacted> + 56
5   CoreLocation                        0x000000018879727c CLClientStopVehicleHeadingUpdates + 142084
6   CoreLocation                        0x000000018876e388 CoreLocation + 21384
7   CoreLocation                        0x000000018876ea78 CLClientCreateWithBundleIdentifierAndPathOnRunLoop + 128
8   CoreLocation                        0x000000018876e980 CLClientCreateWithBundleIdentifierAndPath + 320
9   CoreLocation                        0x000000018877a114 CLClientStopVehicleHeadingUpdates + 22940
10  CoreLocation                        0x000000018877a918 CLClientStopVehicleHeadingUpdates + 24992
11  TYCThree                            0x00000001026168fc -[JCORELocationController setupLocationManager] + 108
12  TYCThree                            0x00000001026159c8 -[JCORELocationController initWithDelegate:] + 124
13  TYCThree                            0x0000000102633a10 -[JPUSHHttpSessionController init] + 204
14  TYCThree                            0x000000010261ddc4 -[JPUSHNetworkController init] + 156
15  TYCThree                            0x0000000102617c74 -[JCOREClientController networkService] + 72
16  TYCThree                            0x000000010261a0c4 -[JCOREClientController reportSession] + 24
17  TYCThree                            0x0000000102617d84 -[JCOREClientController reportLaunch:] + 68
18  TYCThree                            0x0000000102617b9c -[JCOREClientController setup] + 696
19  TYCThree                            0x000000010264e27c +[JCOREInterface setup] + 56
20  TYCThree                            0x000000010267a9e8 -[JPUSHClientController setup] + 148
21  libobjc.A.dylib                     0x00000001809a3604 <redacted> + 68
22  Foundation                          0x0000000182272da8 <redacted> + 340
23  CoreFoundation                      0x00000001817396a0 <redacted> + 28
24  CoreFoundation                      0x000000018173961c <redacted> + 92
25  CoreFoundation                      0x0000000181738ed4 <redacted> + 180
26  CoreFoundation                      0x0000000181733bb4 <redacted> + 1032
27  CoreFoundation                      0x0000000181733494 CFRunLoopRunSpecific + 452
28  CoreFoundation                      0x00000001817341f8 CFRunLoopRun + 84
29  TYCThree                            0x0000000102642b00 -[JPUSHThread clientThreadMain] + 100
30  Foundation                          0x0000000182135f30 <redacted> + 72
31  Foundation                          0x0000000182272bb4 <redacted> + 1044
32  libsystem_pthread.dylib             0x00000001813ae9c8 <redacted> + 132
33  libsystem_pthread.dylib             0x00000001813ae924 _pthread_start + 52
34  libsystem_pthread.dylib             0x00000001813b6ddc thread_start + 4
2018-11-08 11:57:41.732891+0800 TYCThree[1153:193781] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 1153, TID: 193781, Thread name: org.hxhg.jiguang.thread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0
Backtrace:
4   libobjc.A.dylib                     0x00000001809a3894 <redacted> + 56
5   CoreLocation                        0x000000018879727c CLClientStopVehicleHeadingUpdates + 142084
6   CoreLocation                        0x000000018876e388 CoreLocation + 21384
7   CoreLocation                        0x000000018876ea78 CLClientCreateWithBundleIdentifierAndPathOnRunLoop + 128
8   CoreLocation                        0x000000018876e980 CLClientCreateWithBundleIdentifierAndPath + 320
9   CoreLocation                        0x000000018877a114 CLClientStopVehicleHeadingUpdates + 22940
10  CoreLocation                        0x000000018877a918 CLClientStopVehicleHeadingUpdates + 24992
11  TYCThree                            0x00000001026168fc -[JCORELocationController setupLocationManager] + 108
12  TYCThree                            0x00000001026159c8 -[JCORELocationController initWithDelegate:] + 124
13  TYCThree                            0x0000000102633a10 -[JPUSHHttpSessionController init] + 204
14  TYCThree                            0x000000010261ddc4 -[JPUSHNetworkController init] + 156
15  TYCThree                            0x0000000102617c74 -[JCOREClientController networkService] + 72
16  TYCThree                            0x000000010261a0c4 -[JCOREClientController reportSession] + 24
17  TYCThree                            0x0000000102617d84 -[JCOREClientController reportLaunch:] + 68
18  TYCThree                            0x0000000102617b9c -[JCOREClientController setup] + 696
19  TYCThree                            0x000000010264e27c +[JCOREInterface setup] + 56
20  TYCThree                            0x000000010267a9e8 -[JPUSHClientController setup] + 148
21  libobjc.A.dylib                     0x00000001809a3604 <redacted> + 68
22  Foundation                          0x0000000182272da8 <redacted> + 340
23  CoreFoundation                      0x00000001817396a0 <redacted> + 28
24  CoreFoundation                      0x000000018173961c <redacted> + 92
25  CoreFoundation                      0x0000000181738ed4 <redacted> + 180
26  CoreFoundation                      0x0000000181733bb4 <redacted> + 1032
27  CoreFoundation                      0x0000000181733494 CFRunLoopRunSpecific + 452
28  CoreFoundation                      0x00000001817341f8 CFRunLoopRun + 84
29  TYCThree                            0x0000000102642b00 -[JPUSHThread clientThreadMain] + 100
30  Foundation                          0x0000000182135f30 <redacted> + 72
31  Foundation                          0x0000000182272bb4 <redacted> + 1044
32  libsystem_pthread.dylib             0x00000001813ae9c8 <redacted> + 132
33  libsystem_pthread.dylib             0x00000001813ae924 _pthread_start + 52
34  libsystem_pthread.dylib             0x00000001813b6ddc thread_start + 4
(lldb)

#2

你使用的极光 SDK 的版本号多少?

该问题什么情况下出现?复现步骤


(ruru7947) #3

07

開啟app就會出現

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        
        window = UIWindow(frame: UIScreen.main.bounds)
        window?.backgroundColor = UIColor.white
        window?.rootViewController =  LoginNavigationController.init(rootViewController: LoginViewController())
        window?.makeKeyAndVisible()
        
        //推播
        let entity = JPUSHRegisterEntity.init()
        entity.types = Int(JPAuthorizationOptions.alert.rawValue|JPAuthorizationOptions.badge.rawValue|JPAuthorizationOptions.sound.rawValue)
        JPUSHService.register(forRemoteNotificationConfig: entity, delegate: self)
        JPUSHService.setup(withOption: launchOptions, appKey: "xxxxxxxxxxxxxxxx", channel: "xxxxxx", apsForProduction: true)
        
        return true
    }

#4

说明:这个不影响功能,是因为你们打开了那个 main thread check 而出现的,SDK 之后会处理掉。


(ruru7947) #5

了解了,謝謝


(戏) #6

这个问题是苹果系统的问题吗?为什么之前的版本没有出现呢? 探讨一下呗


(一把鼻涕一把泪) #7

12.1上面没有这个警告了,但是在12.1.2上面又出现了
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 5691, TID: 1474167, Thread name: org.hxhg.jiguang.thread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0
Backtrace:
4 libobjc.A.dylib 0x00000001e67b3894 + 56
5 CoreLocation 0x00000001ee5b5260 CLClientStopVehicleHeadingUpdates + 142084
6 CoreLocation 0x00000001ee58c36c CoreLocation + 9068
7 CoreLocation 0x00000001ee58ca5c CLClientCreateWithBundleIdentifierAndPathOnRunLoop + 128
8 CoreLocation 0x00000001ee58c964 CLClientCreateWithBundleIdentifierAndPath + 320
9 CoreLocation 0x00000001ee5980f8 CLClientStopVehicleHeadingUpdates + 22940
10 CoreLocation 0x00000001ee5988fc CLClientStopVehicleHeadingUpdates + 24992
11 qiye 0x00000001005cdc60 -[JCORELocationController setupLocationManager] + 108
12 qiye 0x00000001005ccd2c -[JCORELocationController initWithDelegate:] + 124
13 qiye 0x00000001005ead74 -[JPUSHHttpSessionController init] + 204
14 qiye 0x00000001005d5128 -[JPUSHNetworkController init] + 156
15 qiye 0x00000001005cefd8 -[JCOREClientController networkService] + 72
16 qiye 0x00000001005d1428 -[JCOREClientController reportSession] + 24
17 qiye 0x00000001005cf0e8 -[JCOREClientController reportLaunch:] + 68
18 qiye 0x00000001005cef00 -[JCOREClientController setup] + 696
19 qiye 0x0000000100605784 +[JCOREInterface setup] + 56
20 qiye 0x0000000100635a78 -[JPUSHClientController setup] + 148
21 libobjc.A.dylib 0x00000001e67b3604 + 68
22 Foundation 0x00000001e8082e38 + 340
23 CoreFoundation 0x00000001e754a6c4 + 28
24 CoreFoundation 0x00000001e754a640 + 92
25 CoreFoundation 0x00000001e7549ef8 + 180
26 CoreFoundation 0x00000001e7544bd8 + 1032
27 CoreFoundation 0x00000001e75444b8 CFRunLoopRunSpecific + 452
28 CoreFoundation 0x00000001e754521c CFRunLoopRun + 84
29 qiye 0x00000001005f9e64 -[JPUSHThread clientThreadMain] + 100
30 Foundation 0x00000001e7f45fc0 + 72
31 Foundation 0x00000001e8082c44 + 1044
32 libsystem_pthread.dylib 0x00000001e71bf974 + 132
33 libsystem_pthread.dylib 0x00000001e71bf8d0 _pthread_start + 52
34 libsystem_pthread.dylib 0x00000001e71c7ddc thread_start + 4


#8

SDK 3.1.0 在iOS12.1.2上出现了这个问题,12.1.1没有这个问题了


#9

这个不影响功能,是因为你们打开了那个 main thread check 而出现的


#10

是的,确实不影响正常的使用,但是这个还是得麻烦改一下吧,在非主线程去访问UI的API本身就是不推荐的