1, need to call the following function before using corelocation
IOS8 has made some modifications to the positioning, including the method of locating authorization, Cllocationmanager adds the following two methods:
(1) Always allow access to location information
- (void)requestAlwaysAuthorization;
(2) Allow access to location data during use of the application
- (void)requestWhenInUseAuthorization;
Examples are as follows:
self.locationManager = [[CLLocationManager alloc]init];_locationManager.delegate = self;_locationManager.desiredAccuracy = kCLLocationAccuracyBest;_locationManager.distanceFilter = 10;[_locationManager requestAlwaysAuthorization];//添加这句[_locationManager startUpdatingLocation];
2. Add the following configuration in the Info.plist file:
(1)NSLocationAlwaysUsageDescription
(2)NSLocationWhenInUseUsageDescription
The value of these two keys is the description of the authorization alert, and the example is configured as follows [ 勾选Show Raw Keys/Values后进行添加 ]:
IOS8 above using corelocation positioning