Ios8 system locating
Solution:
1. Add the key in info. plist;
NSLocationWhenInUseDescription, which allows you to obtain the GPS description on the foreground
NSLocationAlwaysUsageDescription, which allows you to obtain the GPS description in the background.
% 20% 20% 20
% 20% 20% 20
2. In code locating, make version differentiation and authorization requests:
If ([CLLocationManager locationServicesEnabled]) {if (! Self. locationManager) {self. locationManager = [[CLLocationManager alloc] init];} self. locationManager. delegate = self; self. locationManager. distanceFilter = 1.0; self. locationManager. desiredAccuracy = kCLLocationAccuracyBest; if ([self. locationManager respondsToSelector: @ selector (requestAlwaysAuthorization)]) {[self. locationManager requestAlwaysAuthorization]; // permanently authorizes [self. locationManager requestWhenInUseAuthorization]; // In-use authorization} [self. locationManager startUpdatingLocation]; // enables location update self. delegate = delegate ;}
OK. This change also shows that Apple began to design layers for privacy authorization. Authorization is no longer limited to two choices or not. This is a good thing!