微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

iOS CoreLocation(null)崩溃

我通过Crashlytics在我的应用程序中收到此错误.我无法找到崩溃发生的地点和方式.以下是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

有人能指出我正确的方向吗?谢谢

解决方法

当应用程序变为非活动状态时,计时器需要无效.在 applicationWillResignActive方法中,使计时器对象无效.您可以在 applicationDidBecomeActive方法中重新设置它.来自文档:

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.

如果要构建需要在后台收集位置的应用程序,请确保使用位置更新后台功能.

您还可以试用适用于iOS的HyperTrack SDK,它将为您设置更多功能,以便您可以构建您的位置功能,而不必担心这项繁重的工作. (免责声明:我在HyperTrack工作.)

原文地址:https://www.jb51.cc/iOS/331630.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐