简体   繁体   中英

Location Services Permission reset upon app upgrade on iOS

Summary:

Is it possible for iOS/App Store to reset an app's Location Service permission on app upgrade?

Detailed:

In our recent app upgrade, we believe quite a few of users that had previously granted our app "Always" Location Services permission as a result of enabling certain features were prompted with a While in Use Location Services prompt on first launch of the new version of our app. Since there is no context around this permission prompt, many of our users likely selected Don't Allow at this time.

AFAIK, it is not possible for our app to reset the user's permission settings via code. Is anyone aware of a certain version of iOS and/or device combination that would lead to this behaviour upon app upgrade?

The only time when our app would prompt users for Location Services permissions is if the authorizationStatus is set to kCLAuthorizationStatusNotDetermined. Otherwise we would start to request for location updates.

Here's a snippet of our app's launch code:

CLLocationManager *lmFollowMe = [[CLLocationManager alloc] init];
[lmFollowMe setDesiredAccuracy:kCLLocationAccuracyKilometer];
[lmFollowMe setDistanceFilter:1000];
[lmFollowMe setDelegate:self];
if ([lmFollowMe respondsToSelector:@selector(setAllowsBackgroundLocationUpdates:)]) {
    [lmFollowMe setAllowsBackgroundLocationUpdates:NO];
}
[self setFollowMeLocationManager:lmFollowMe];
...

if ([CLLocationManager locationServicesEnabled] == YES) {
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
if (status == kCLAuthorizationStatusDenied) {
   ...
} else if (status == kCLAuthorizationStatusRestricted) {
   ...
} else if (status == kCLAuthorizationStatusNotDetermined) {

   if ([self followMeStarted] == NO) {
       [self setFollowMeStarted:YES];
       [[self followMeLocationManager] requestWhenInUseAuthorization];
   }
} else {
     [[self followMeLocationManager] startUpdatingLocation];
}
...

Thanks!

You can not change location permission through code, but if user denied location permission then you can show alert for ask location permission with 'Setting' & 'Cancel' buttons.

If user click on 'Setting' then you can redirect user to application's setting page to update location permission by following code.

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];

Thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM