amapapi / iOS_Loc_Demo

iOS_Loc_Demo
27 stars 15 forks source link

这个是不是高德定位的bug。线程安全问题 #2

Open zhuzhiyongai opened 5 years ago

zhuzhiyongai commented 5 years ago

2019-04-28 16:19:54.050911+0800 xxx[3270:759735] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState] PID: 3270, TID: 759735, Thread name: com.autonavi.AMapLocationThread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0 Backtrace: 4 libobjc.A.dylib 0x00000001c32976f4 + 56 5 CoreLocation 0x00000001caea77b8 CLClientStopVehicleHeadingUpdates + 133972 6 CoreLocation 0x00000001cae80b1c CoreLocation + 6940 7 CoreLocation 0x00000001cae811d4 CLClientCreateWithBundleIdentifierAndPathOnRunLoop + 136 8 CoreLocation 0x00000001cae810d8 CLClientCreateWithBundleIdentifierAndPath + 300 9 CoreLocation 0x00000001cae8c080 CLClientStopVehicleHeadingUpdates + 21532 10 CoreLocation 0x00000001cae8c864 CLClientStopVehicleHeadingUpdates + 23552 11 xxx 0x0000000101a115a8 -[AMapLocationManager initCLManager] + 56 12 xxx 0x0000000101a11534 -[AMapLocationManager createLocationManager] + 28 13 libobjc.A.dylib 0x00000001c3297454 + 68 14 Foundation 0x00000001c4b32234 + 340 15 CoreFoundation 0x00000001c4023954 + 28 16 CoreFoundation 0x00000001c40238d0 + 92 17 CoreFoundation 0x00000001c402318c + 180 18 CoreFoundation 0x00000001c401de60 + 988 19 CoreFoundation 0x00000001c401d764 CFRunLoopRunSpecific + 452 20 Foundation 0x00000001c49fd57c + 304 21 Foundation 0x00000001c4a39e70 + 92 22 xxx 0x0000000101a06254 +[AMapLocationCLMDelegate threadEntryPoint:] + 216 23 Foundation 0x00000001c49fc184 + 72 24 Foundation 0x00000001c4b32040 + 988 25 libsystem_pthread.dylib 0x00000001c3c9d920 + 132 26 libsystem_pthread.dylib 0x00000001c3c9d87c _pthread_start + 48 27 libsystem_pthread.dylib 0x00000001c3ca5dcc thread_start + 4

eidanlin commented 5 years ago

你好,这是我们定位SDK的问题,只是一个警告,不是线程安全问题,不影响正常使用。 我们在定位SDK内部创建了一个子线程来初始化系统定位管理类 CLLocationManager,而 CLLocationManager 内部会调用 [UIApplication applicationState](涉及到UI操作),所以系统要求放在主线程,所以会报警告。目前去除警告的方式,可以在 Diagnostics 中将 不要选择 Main Thread Checker ,我们后续会解决该问题。