Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CLLocationmanager delegate method is not working in xcode6 [duplicate]

i am created new project in Xcode6 and added the old files to this project(old files is created in xcode5) ,But whats happening is everything working fine, but "didUpdateToLocation" delegate method is not calling, i also used "didUpdateLocations" delegate method but both are not working.Code i have used from old file but the core location framework has been added from xcode6 ,I don't know what i am missing please anyone guide me to get a solution.

like image 385
ashok vadivelu Avatar asked Jul 26 '14 14:07

ashok vadivelu


1 Answers

If you're testing this on iOS 8 device / Simulator, old location code may not work because of the way the iOS 8 handles Location Services permission access. As of current iOS 8 beta, you need to use new -requestWhenInUseAuthorization method:

- (void)updateCurrentLocation {

    if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
        [self.locationManager requestWhenInUseAuthorization];
    }

    [self.locationManager startUpdatingLocation];
}

The user prompt contains the text from the NSLocationWhenInUseUsageDescription key in your app’s Info.plist file, and the presence of that key is required when calling this method.

<key>NSLocationWhenInUseUsageDescription</key>
<string>We use your location to find places near you.</string>
like image 107
Rinat Khanov Avatar answered Oct 22 '22 05:10

Rinat Khanov