如何在后台使用 NSTimer 和 applicationDidEnterBackground
方法调用 locationManager
函数?
最佳答案
为什么需要计时器?如果您将委托(delegate)设置为接收来自位置更新的回调,则不需要计时器。如果您需要主动位置跟踪,如果长时间运行,您将承受巨大的电池电量。当您进入后台切换到 -monitorForSignificantLocationChanges 时,您会过得更好。将您的 AppDelegate 注册为 Location Manager Delegate,然后根据回调执行您需要执行的操作。
关于iphone - 我如何在后台使用 nstimer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7737418/