Я хочу, чтобы мое приложение обновляло местоположение в фоновом режиме.Я реализовал ниже код.
locationManager.pausesLocationUpdatesAutomatically =false
self.locationManager = CLLocationManager()
locationManager.requestWhenInUseAuthorization()
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation
locationManager.allowsBackgroundLocationUpdates=true
locationManager.startMonitoringSignificantLocationChanges()
self.locationManager.startUpdatingLocation()
- Этот код управляется в
appdelegate
didFinishLaunchingWithOptions()