【问题标题】:Restart GPS after device reboot on ios在 ios 上重新启动设备后重新启动 GPS
【发布时间】:2013-12-26 11:14:36
【问题描述】:

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

谁能建议我如何克服这个问题?

谢谢,

【问题讨论】:

    标签: ios gps reboot


    【解决方案1】:

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

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

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

    【讨论】:

      【解决方案2】:

      您应该使用CLLocationManager 类的startMonitoringSignificantLocationChanges。根据苹果文档,即使系统杀死了您的应用程序,它也会在您的设备大幅移动时再次调用您的应用程序。

      【讨论】: