iOS Revoke Location Services Permission Programmatically

iOS revoke location services permission programmatically

Once a user has granted (or denied) location permissions by responding to the original permission request dialog, the only way that the permissions can be changed is by the user themselves using the device settings app.

You can just not use location services even though your app still has permission to do so.

Facebook SDK remove app permissions programmatically

I found the answer in this link Revoke Login

[[[FBRequest alloc]initWithSession:[FBSession activeSession] graphPath:@"me/permissions" parameters:nil HTTPMethod:@"delete"] startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
// Handling
}];

How to force 'always' location access in iOS app

A few observations about this flow where we request “when in use” first, and when that's granted, only then request “always” (as discussed in WWDC 2020 What's New in Location):

  1. Make sure you run this on a device, not the simulator. You may not see the subsequent “upgrade ‘when-in-use’ to ‘always’” permission alert when using a simulator.

  2. This feature was introduced in iOS 13.4. Make sure you are not attempting this on an earlier iOS 13 version. On those earlier versions, you won’t see the second alert to upgrade to “always”.

  3. Make sure you don’t have a lingering requestAlwaysAuthorization elsewhere in your code-base that might have put the app in a “provisional always” state. Once in provisional state, you are locked into the provisional flow of 13.0.


I know it isn’t what you’re looking for, but for the sake of future readers, the alternative to the above is the simpler “provisional always” flow introduced in iOS 13.0 (outlined in WWDC 2019's What's New in Core Location). You just call requestAlwaysAuthorization (never calling requestWhenInUseAuthorization). Apple's intent here was to let the user better reason about what’s going on, showing the “when in use” alert while the app is in use and automatically showing the “always” upgrade alert when location services are used while the app isn't running.



Related Topics



Leave a reply



Submit