2017-09-09 90 views
-3

我使用CLLocationManager跟踪定位和它的委托如何某些应用程序可以跟踪即使应用程序是封闭

_locationManager = [ CLLocationManager new ]; 
_locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation; 
_locationManager.allowsBackgroundLocationUpdates = true; 
_locationManager.pausesLocationUpdatesAutomatically = false; 

如何更新的代码时,应用程序是封闭的跟踪定位位置。应用程序如何跟踪位置并在需要时发送本地通知。

回答

0

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

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

希望这会有所帮助。

+0

当App终止但不能最小化时,会使用它吗? –