Using corelocation positioning in iOS8
1, before using corelocation need to call the following function "IOS8 dedicated":
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 application use
-(void) requestwheninuseauthorization;
Examples are as follows:
123456 |
Self.locationmanager = [[Cllocationmanager alloc]init];_locationmanager.delegate = self;_locationmanager.desiredaccuracy = kcllocationaccuracybest;_locationmanager.distancefilter = ten;[_locationmanager requestalwaysauthorization];//Add this sentence[_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, the example configuration is as follows [ tick show Raw keys/values to add ]:
Using corelocation positioning in iOS8