iPad remembering camera permissions after delete—how to clear?

廉价感情. 提交于 2019-11-26 12:08:24

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/27726354/ipad-remembering-camera-permissions-after-delete-how-to-clear

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!