I added CLLocationManager to my application using Swift in the AppDelegate file.
In the Appdelegate.swift file
import CoreLocation @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, CLLocationManagerDelegate { var locationManager: CLLocationManager!
In the didbecomeActive method:
func applicationDidBecomeActive(application: UIApplication) { if((locationManager) != nil) { locationManager.stopMonitoringSignificantLocationChanges() locationManager.delegate = nil locationManager = nil } locationManager = CLLocationManager() locationManager.delegate = self locationManager.desiredAccuracy = kCLLocationAccuracyBest locationManager.activityType = CLActivityType.OtherNavigation locationManager.requestAlwaysAuthorization() locationManager.startMonitoringSignificantLocationChanges() }
If I use startUpdatingLocation , the didUpdateLocations method didUpdateLocations called, but not for startMonitoringSignificantLocationChanges .
Why it is not called for startMonitoringSignificantLocationChanges . I am testing this in an ios simulator. I do not know how to check the device.
ios swift ios-simulator cllocationmanager location-services
Nazik
source share