iOS CoreLocation(null)崩溃 [英] iOS CoreLocation (null) crash
问题描述
我通过Crashlytics在我的应用中收到此错误。我无法找到崩溃发生的地点和方式。以下是Crashlytics的日志:
I've been getting this error in my app through Crashlytics. I can't find where and how this crash occurs. Here is the log from Crashlytics:
Thread : Crashed: com.apple.main-thread
0 CoreLocation 0x0000000183f62304 (null) + 60044
1 CoreLocation 0x0000000183f230f0 (null) + 1436
2 CoreLocation 0x0000000183f230f0 (null) + 1436
3 CoreLocation 0x0000000183f2261c (null) + 1980
4 CoreFoundation 0x0000000183754c9c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28
5 CoreFoundation 0x0000000183754940 __CFRunLoopDoTimer + 884
6 CoreFoundation 0x0000000183752054 __CFRunLoopRun + 1520
7 CoreFoundation 0x0000000183680dc0 CFRunLoopRunSpecific + 384
并且还说明:
崩溃:com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS位于0x6136383561626000
and this is also stated: Crashed: com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x6136383561626000
任何人都可以指出我正确的方向吗?谢谢
Anyone can point me to the right direction? Thanks
推荐答案
当应用程序变为非活动状态时,计时器需要无效。在 applicationWillResignActive 方法中,使计时器对象无效。您可以在 applicationDidBecomeActive 方法中将其重置回来。来自文档:
The timer needs to be invalidated when the app is becoming inactive. In the applicationWillResignActive method, invalidate the timer object. You can reset it back in the applicationDidBecomeActive method. From the docs:
您应该使用此方法暂停正在进行的任务,禁用计时器,以及
降低OpenGL ES帧速率。游戏应该使用这种方法来暂停游戏
。处于非活动状态的应用程序应该在等待转换到活动或后台
状态时执行最小
工作。
You should use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. An application in the inactive state should do minimal work while it waits to transition to either the active or background state.
如果您正在构建需要在后台收集位置的应用程序,请确保使用位置更新后台功能。
If you are building an app that needs to collect location in the background, ensure that you location updates background capabilities are utilised.
您还可以试用适用于iOS的 HyperTrack SDK将为您设置更多内容,以便您可以构建位置功能而不用担心这个问题繁重的工作。 (免责声明:我在HyperTrack工作。)
You can also try out the HyperTrack SDK for iOS which will set this up and more for you so that you can build your location feature and not worry about this grunt work. (Disclaimer: I work at HyperTrack.)
这篇关于iOS CoreLocation(null)崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!