I am trying to determine in AppDelegate if user set location permissions for application to "Never". My app always crashing if not getting location.
my code in AppDelegate is:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
//location
var manager = CLLocationManager()
if CLLocationManager.authorizationStatus() == .Restricted
|| .authorizationStatus() == .Denied {
manager.requestWhenInUseAuthorization()
manager.requestAlwaysAuthorization()
}
}
Can anyone help me to resolve this issue?
The best article about CoreLocation and requesting authorization is here: http://nshipster.com/core-location-in-ios-8/
A couple of points: