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
Add key NSLocationWhenInUseUsageDescription
or NSLocationAlwaysUsageDescription
(background GPS use) with string asking to use GPS on each info.plist
from each target.
Ask for permission by running:
[self initLocationManager:locationManager];
Where initLocationManager
is:
// asks for GPS authorization on iOS 8
-(void) initLocationManager:(CLLocationManager *) locationManager{
locationManager = [[CLLocationManager alloc]init];
if([locationManager respondsToSelector:@selector(requestAlwaysAuthorization)])
[locationManager requestAlwaysAuthorization];
}
Remember that if the keys are not on each info.plist
for each target the app will not ask the user. The if
provides compatibility with iOS 7 and the respondsToSelector:
method guarantees future compatibility rather than just solving the issue for iOS 7 and 8.