Xcode 6 GM - CLLocationManager
I have a project built using Xcode 5. I have a ViewController where I grab the location of the phone using the CLLocationManager. I followed both options:
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
-(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
which worked great.
Now I have opened the project with Xcode 6 GM and neither of these two methods are called (not on simulator or device).
Any ideas? Thanks to
source to share
Please view the thread here
You have to take care of two things
1.
-
requestAlwaysAuthorization
- for background location[self.locationManager requestWhenInUseAuthorization];
or -
requestWhenInUseAuthorization
-location only with active application[self.locationManager requestAlwaysAuthorization];
If you don't make either of the two requests, iOS will ignore the startUpdateLocation request.
2. Include NSLocationAlwaysUsageDescription
or NSLocationWhenInUseUsageDescription
key in Info.plist depending on what permission you are requesting. This string will be passed to the iOS user, so the user can get an idea of why our application needs permission.
Hope it helps.
source to share