iOS CoreLocation (null) crash

谁都会走 提交于 2019-12-02 21:13:15

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:

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.

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.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!