在ios上重新启动设备后重新启动GPS



我是ios的新手,正在编写一个使用GPS的应用程序。此应用程序甚至可以在后台工作。我在这里面临的问题是,在设备(ios)重新启动后台的应用程序后,没有收到任何GPS更新。(我需要在设备上重新启动应用程序才能接收GPS更新)

任何人都可以建议我如何克服这个问题吗?

谢谢

为此,您需要在应用程序进入后台时使用startMonitoringSignificantLocationChanges

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    [self.locationManager startMonitoringSignificantLocationChanges];
}

现在,当您的设备重新启动并且每当有任何位置更新可用时(根据SignificantLocationChanges的 crieterion),您的应用程序会自动从后台调用并且应用程序运行是后台。

你应该使用CLLocationManager类的startMonitoringSignificantLocationChanges。根据 apple 文档,即使系统终止了您的应用程序,当您的设备显着移动时,它也会再次调用您的应用程序。

最新更新