简体   繁体   中英

Reset permissions for ALAssetsLibrary in the simulator

I have an iOS app which needs to ask the user for permissions to access their photos. 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.

I can use [ALAssetsLibrary authorizationStatus] to get the current status (my app is targeting > iOS 6.0 only). I'm trying test the ALAuthorizationStatusNotDetermined case, but I've already granted my app access. 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 :

No privacy alerts are displayed in iOS Simulator for apps that access Photos, Contacts, Calendar, and Reminders.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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