Reputation: 5268
Am using CLLocationManager to get current location . Specifically in iOS 8 , it's delegate methods are not getting fired .
I have set allow in location services please refer screen shot below
Please find my code below:
self.myLocationManager = [[CLLocationManager alloc]init];
[self.myLocationManager setDelegate:self];
self.myLocationManager.distanceFilter = kCLDistanceFilterNone;
self.myLocationManager.desiredAccuracy = kCLLocationAccuracyBest;
[self.myLocationManager startUpdatingLocation];
and i tried using method of iOS 8 . And set a property NSLocationAlwaysUsageDescription
in plist but still am not able to get location
self.myLocationManager requestAlwaysAuthorization];
Upvotes: 0
Views: 1125
Reputation: 5128
It doesn't look like you've set a value for NSLocationAlwaysUsageDescription
.
Upvotes: 0
Reputation: 8349
Step 1:
Add the below code:
SEL requestSelector = NSSelectorFromString(@"requestAlwaysAuthorization");
if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined &&
[locationManager respondsToSelector:requestSelector]) {
[locationManager performSelector:requestSelector withObject:NULL];
} else {
[locationManager startUpdatingLocation];
}
Step 2:
Add NSLocationAlwaysUsageDescription
to info.plist
Upvotes: 1