简体   繁体   English

在模拟器中重置ALAssetsLibrary的权限

[英]Reset permissions for ALAssetsLibrary in the simulator

I have an iOS app which needs to ask the user for permissions to access their photos. 我有一个iOS应用程序,需要要求用户访问他们的照片的权限。 I am trying to enhance the user experience by displaying a prompt and explanation to the user the first time the app requests iOS for permission. 我试图通过在应用程序第一次请求iOS权限时向用户显示提示和说明来增强用户体验。

I can use [ALAssetsLibrary authorizationStatus] to get the current status (my app is targeting > iOS 6.0 only). 我可以使用[ALAssetsLibrary authorizationStatus]来获取当前状态(我的应用仅针对目标> iOS 6.0 )。 I'm trying test the ALAuthorizationStatusNotDetermined case, but I've already granted my app access. 我正在尝试测试ALAuthorizationStatusNotDetermined案例,但我已经授予了我的应用访问权限。 According to another SO question, here , the device cannot reset the permissions (they are either on or off, even if the app is deleted and reinstalled). 根据另一个问题, 在这里 ,设备无法重置权限(即使应用程序被删除并重新安装,它们也会打开或关闭)。

But I am wondering if this can be done in the simulator. 但我想知道这是否可以在模拟器中完成。 Can I reset the photo access permissions in the simulator? 我可以在模拟器中重置照片访问权限吗? There don't seem to be any google question/answers about this? 似乎没有关于此的谷歌问题/答案? Simply deleting and reinstalling the app in the simulator does not work. 只需在模拟器中删除并重新安装应用程序即可。

Are there any under-the-hood files we can reset? 我们可以重置任何引擎盖下的文件吗? - seeing how we have access to the simulators file system, unlike the devices. - 与设备不同,了解我们如何访问模拟器文件系统。

Any thoughts would be great! 任何想法都会很棒! Thanks! 谢谢!

在iOS 7中,您可以像在设备上一样重置模拟器中的隐私警告:

 General -> Reset -> Reset Location & Privacy

According to the iOS 6.0 Release Notes : 根据iOS 6.0发行说明

No privacy alerts are displayed in iOS Simulator for apps that access Photos, Contacts, Calendar, and Reminders. iOS模拟器中没有为访问照片,通讯录,日历和提醒的应用程序显示隐私警报。

So you cannot test the prompt asking for access to photos on the Simulator at all, you have to test it on the device. 因此,您根本无法测试要求访问模拟器上的照片的提示,您必须在设备上进行测试。 On the device you can reset the privacy settings in the "Settings" app (General > Reset > Reset Location & Privacy). 在设备上,您可以在“设置”应用程序中重置隐私设置(常规>重置>重置位置和隐私)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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