我正在尝试重新创建以下代码返回 AVAuthorizationStatusNotDetermined 的条件:
I'm trying to recreate the condition where the following code returns AVAuthorizationStatusNotDetermined:
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];但是,即使在应用程序被删除并重新安装后,iPad 似乎也会记住相机权限,因此每次都会返回 Authorized 或 NotAuthorized.知道如何重置权限以返回 NotDetermined 吗?
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?
感谢阅读.
推荐答案您无法以编程方式重置权限.如果要重置权限,有两种方法:
You can't reset the permission programmatically. If you want to reset the permission there are two ways:
我知道这两个选项对开发人员来说真的没有帮助,如果他们试图测试它的话.
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.
如 技术说明 TN2265 中所述/a>:
您可以通过以下步骤实现后者,而无需实际等待一天:
You can achieve the latter without actually waiting a day by following these steps:
- 从设备中删除您的应用.
- 完全关闭设备,然后重新打开.
- 进入设置 >一般 >日期&时间并将日期提前一天或更长时间.
- 再次完全关闭设备,然后重新打开.
第二个选项
当您删除一个应用程序时,iOS 会将您的应用程序的权限映射到您的应用程序的捆绑包 ID,它会保留一天的数据.因此,您还可以更改应用的 bundle id 以进行测试.
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.
正如@rmaddy 在评论中所建议的,您可以重置所有位置和隐私权限:设置 ->一般->重置->重置位置隐私.请注意,这将重置该设备上所有应用的所有位置和隐私权限.
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.
更多推荐
iPad删除后记住相机权限
发布评论