是否有可能在后台iOS 4中定期运行任务
问题描述:
我想在后台轮询GPS的位置。所以我们使用了一个NSTimer,并在定时器计时器中进行定期检查。换句话说,我们可以在应用程序处于后台时安排NSTimer吗?
I want to poll the location from GPS in the background. So we used a NSTimer and performed periodic checks in the timer tick. In other words, can we schedule NSTimer while the app is in Background?
提前致谢
Thanks in advance
答
您不能定期执行任意代码,但是您可以通过 startMonitoringSignificantLocationChanges in CLLocationManager。
You can't periodically execute arbitrary code, but you can get pinged on significant location changes via startMonitoringSignificantLocationChanges in CLLocationManager.