IOS 8 Location Supplement
IOS 8 targeting needs to be modified in 2 places
Add Nslocationalwaysusagedescription: Description information in the 1.info.plist file
Starting with iOS 8, user location is always used in two situations: Nslocationalwaysusagedescription when using the app: Nslocationwheninusedescription
2. Calling in Cllocationmanager
-(void) requestalwaysauthorization
-(void) requestwheninuseauthorization
#import "ViewController.h"#import<CoreLocation/CoreLocation.h>@interfaceViewcontroller () <CLLocationManagerDelegate>@property (nonatomic,strong) Cllocationmanager*Mgr;@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; [Self.mgr startupdatinglocation]; //if it is iOS8, you need to request authorization method (to judge, otherwise the iOS7 will crash, need to first configure in Info.plist)//1. Determine if a request for Requestalwaysauthorization authorization is required by judging the system's judgment//if ([Uidevice currentdevice].systemversion.floatvalue >= 8.0) {//[Self.mgr requestalwaysauthorization];// } //2. Determine if you need to request requestalwaysauthorization authorization by judging whether this method is available if([Self.mgr respondstoselector: @selector (requestalwaysauthorization)]) {[Self.mgr requestalwaysauthorization]; }}- (void) Locationmanager: (Cllocationmanager *) Manager didupdatelocations: (Nsarray *) locations{NSLog (@"get to the user's location");}-(Cllocationmanager *) mgr{if(_mgr = =Nil) {_mgr=[[Cllocationmanager alloc] init]; _mgr.Delegate=Self ; } return_mgr;}@end
IOS8 positioning Supplement