Location Services not working in iOS 8

前端 未结 26 2644
滥情空心
滥情空心 2020-11-21 10:23

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

26条回答
  •  生来不讨喜
    2020-11-21 10:45

    Solution with backward compatibility:

    SEL requestSelector = NSSelectorFromString(@"requestWhenInUseAuthorization");
    if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined &&
        [self.locationManager respondsToSelector:requestSelector]) {
        [self.locationManager performSelector:requestSelector withObject:NULL];
    } else {
        [self.locationManager startUpdatingLocation];
    }
    

    Setup NSLocationWhenInUseUsageDescription key in your Info.plist

提交回复
热议问题