iphone - 我如何在后台使用 nstimer

标签 iphone ios background nstimer core-location

如何在后台使用 NSTimer 和 applicationDidEnterBackground 方法调用 locationManager 函数?

最佳答案

为什么需要计时器?如果您将委托(delegate)设置为接收来自位置更新的回调,则不需要计时器。如果您需要主动位置跟踪,如果长时间运行,您将承受巨大的电池电量。当您进入后台切换到 -monitorForSignificantLocationChanges 时,您会过得更好。将您的 AppDelegate 注册为 Location Manager Delegate,然后根据回调执行您需要执行的操作。

关于iphone - 我如何在后台使用 nstimer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7737418/

相关文章:

iphone - 从 Xcode 中文本的 UIImage 获取可编辑文本

iphone - NSFetchedResultsController 的 sectionNameKeyPath 不工作

iOS PayUMoney SDK key 无效

css - 更改屏幕尺寸时背景变小,div 相互重叠

ios - <NSMutableURLRequest : 0x1c0c7ae0> { URL: (null) } in Objective C

ios - 为什么有时我的 UIBarButton 很粗有时很细

android - 套接字 io + MQTT

iphone - iOS4 - iPhone模拟器的背景音频

html - 在手机上覆盖背景大小

ios - iPhone 6和iPhone 6 Plus的应用程序屏幕顶部和底部有1像素黑线