First plist defines two string: nslocationwheninuseusagedescriptionnslocationalwaysusagedescription and then calls [ Self.locationmanager requestwheninuseauthorization] or [Self.locationmanager requestalwaysauthorization] For example #import " ViewController.h "@import corelocation; @interface Viewcontroller () @property (Strong, Nonatomic) Cllocationmanager *locationmanager; @end @implementation viewcontroller -(void) viewdidload{ [super viewdidload]; //* * Don ' t forget to add Nslocationwheninuseusagedescription in Myapp-info.plist and give it a string Self.locationmanager = [[Cllocationmanager alloc] init]; self.locationmanager.delegate = self ; //Check for IOS 8. Without this guard the code would crash with "unknown selector" on IOS 7. if ([Self.locationmanager Respondstoselector: @selector (requestwheninuseauthorization)]) { [self.locationmanager requestwheninuseauthorization]; } [self.locationmanager startupdatinglocation];} //Location Manager Delegate Methods -(void) Locationmanager: (Cllocationmanager *) Manager Didupdatelocations: (Nsarray *) Locations{ nslog (@ "%@", [locations Lastobject]);} @end
IOS 8 Location failure problem