My app that worked fine on iOS 7 doesn\'t work with the iOS 8 SDK.
CLLocationManager
doesn\'t return a location, and I don\'t see my app under
I was working on an app that was upgraded to iOS 8 and location services stopped working. You'll probably get and error in the Debug area like so:
Trying to start MapKit location updates without prompting for location authorization. Must call -[CLLocationManager requestWhenInUseAuthorization] or -[CLLocationManager requestAlwaysAuthorization] first.
I did the least intrusive procedure. First add NSLocationAlwaysUsageDescription
entry to your info.plist:
Notice I didn't fill out the value for this key. This still works, and I'm not concerned because this is a in house app. Also, there is already a title asking to use location services, so I didn't want to do anything redundant.
Next I created a conditional for iOS 8:
if ([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
[_locationManager requestAlwaysAuthorization];
}
After this the locationManager:didChangeAuthorizationStatus:
method is call:
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus: (CLAuthorizationStatus)status
{
[self gotoCurrenLocation];
}
And now everything works fine. As always, check out the documentation.