iPad remembering camera permissions after delete—how to clear?
Asked Answered
F

6

67

I'm trying to recreate the condition where the following code returns AVAuthorizationStatusNotDetermined:

AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];

However, the iPad appears to remember camera permissions even after the app is deleted and reinstalled, and so either Authorized or NotAuthorized is returned every time. Any idea how to reset the permissions so that NotDetermined is returned?

Thanks for reading.

Floeter answered 31/12, 2014 at 21:13 Comment(0)
C
125

You can't reset the permission programmatically. If you want to reset the permission there are two ways:

  1. Reset the OS
  2. Uninstall the app and wait for a day

I know both of those options are really not helpful for a developer, if they are trying to test it out something.

There are three alternatives for testing your app's first run scenario without resetting the entire OS or waiting a day.

First option

As described in Technical Note TN2265 :

You can achieve the latter without actually waiting a day by following these steps:

  • Delete your app from the device.
  • Turn the device off completely and turn it back on.
  • Go to Settings > General > Date & Time and set the date ahead a day or more.
  • Turn the device off completely again and turn it back on.

Second option

When you delete an app the iOS keeps the permission of your app mapped to your app's bundle id, it keeps the data for day. So you can also change your app's bundle id to test it out.

Third Option

As suggested by @rmaddy in the comment you can reset all location and privacy permissions : Settings -> General -> Reset -> Reset Location & Privacy. Note that this will reset all location and privacy permissions for all the apps on that device.

Choong answered 31/12, 2014 at 21:21 Comment(11)
This works, thanks! I also found that just changing the Bundle Identifier in XCode did the trick as well.Floeter
@Rogare: Yes, that will also help, because after deleting the app, iOS keeps the permissions mapped with your app's bundle id for a day. So either you can change the bundle id or the dateChoong
Why not simply do it the easy way? Settings -> General -> Reset -> Rest Location & PrivacyInflame
@rmaddy: It'll reset the settings for all the apps installed on that device.Choong
But it's a development device so it doesn't really matter. :)Inflame
@rmaddy: Yes, that's true :) (But I use my own device for development). Happy New Year :)Choong
Prefer the second solution,just change key "CFBundleIdentifier"'s value in Info.plist,build and run your app,the camera permission prompt is showing up,and it is much faster than the first one when testing.Sunfish
@MidhunMP do you know where can I find in the apple documentation, something related to keeping the permissions for a day after uninstalling?Nonna
@razvan: As mentioned in my answer, please go to the technical note link. And search for the "Resetting the Push Notifications Permissions Alert on iOS" section.Choong
the 3rd option should really be the 1st option 🤓Blindfold
I can't imagine we need to deal with this in 2022.Terrenceterrene
P
1

This is no longer an issue if you update OS version on your device to the latest. It didnt work on 13.3.1 but it did clear permissions after 13.4.1

Polarize answered 2/5, 2020 at 1:8 Comment(3)
Still an issue on iOS 13.5.1. I have to clear privacy & location settings to test camera authorisation. Otherwise it doesn't ask even after delete, restart, re-install.Mayence
Still getting the issue in iOS 13.5Chad
Just tested with Xcode 12.4 on an iOS Simulator 14.4 and a real device iOS 14.5 beta 3. No issue at all.Richards
D
1

On iOS 14 go to Settings->Privacy->Location Services, select the app and for allow location access pick "Ask Next Time"

enter image description here

Drilling answered 13/9, 2020 at 17:20 Comment(1)
These instructions are for Location Services, but the question is about Camera permission. There is no option for "ask next time" with the Camera.Planography
K
1

What worked for me:

Windows -> Devices And Simulators -> Installed Apps section

Remove the app from there using the - button.

Keavy answered 24/1, 2021 at 15:18 Comment(1)
meta.stackexchange.com/questions/104227/…Hardner
M
0

In order to test Camera Permissions you not always need actual device.

You can use Simulator for testing Camera Permissions only. Camera Permissions modal will pops up and you will be able to test both flows - when user taps OK or Don't Allow button.

For several test runs, you can create new Simulator device or Erase Content for the old one

Make Simulator active and choose in Topbar Menu

Device/Erase all content and Settings

enter image description here

Mudguard answered 13/12, 2023 at 10:51 Comment(1)
But a simulator doesn't support a camera at all.Rebuke
E
0

In experiencing this issue myself, I've identified a solution that doesn't involve resetting my Location & Privacy settings or any of the other drastic measures proposed here:

  1. Before uninstalling the app, navigate to the Settings page for the app in question and manually disable any and all permissions that have been granted
  2. Delete the app and reinstall

In my experience, I've observed that "approved" status for a permission sometime persists across installs, but "denied" status does not.

Erosive answered 6/2 at 23:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.