Vinodh
Vinodh

Reputation: 5268

CLLocationmanager updateLocations delegate method not getting called in iOS 8

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 enter image description here

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

Answers (2)

incanus
incanus

Reputation: 5128

It doesn't look like you've set a value for NSLocationAlwaysUsageDescription.

Upvotes: 0

PREMKUMAR
PREMKUMAR

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

enter image description here

Upvotes: 1

Related Questions