【问题标题】:how can I use nstimer in background如何在后台使用 nstimer
【发布时间】:2011-10-12 08:46:41
【问题描述】:

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

【问题讨论】:

  • 你能帮帮我吗?????

标签: iphone ios background nstimer core-location


【解决方案1】:

为什么需要计时器?如果您将代理设置为接收来自位置更新的回调,则不需要计时器。如果您需要主动位置跟踪,如果长时间运行,您将遭受巨大的电池冲击。当您进入后台切换到 -monitorForSignificantLocationChanges 时,您会更好。将您的 AppDelegate 注册为 Location Manager Delegate,然后从回调中执行您需要执行的操作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-04-02
    • 2012-01-08
    • 2012-03-02
    • 2012-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多