即使应用程序已关闭,某些应用程序如何跟踪位置

时间:2017-09-09 06:42:20

标签: ios objective-c core-location

我使用CLLocationManager及其委托

跟踪位置
_locationManager = [ CLLocationManager new ];
_locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
_locationManager.allowsBackgroundLocationUpdates = true;
_locationManager.pausesLocationUpdatesAutomatically = false;

如何在App关闭时更新代码以跟踪位置。应用程序如何跟踪位置并在我想要的时候发送本地通知。

1 个答案:

答案 0 :(得分:0)

您可以通过在info.plist文件中添加以下密钥来请求您的应用在后台模式下运行。

<key>UIBackgroundModes</key>
    <array>
        <string>location</string>
    </array>

希望这有帮助。