iOS simulator permission denied and not showing permission alert dialog

偶尔善良 提交于 2020-01-01 05:22:05

问题


I'm working on iOS simulator and am facing issues for requesting permissions.

My app was working properly and it could access to photo library, camera and location service. But after installing new XCode (8.1), I run the app on simulator, the app is not allowed to use photo library or camera or location service any more.

I tried to ask the permission programmatically, but it did not show permission request dialog and always return denied status even though I added the privacy descriptions and bundle display name.


回答1:


I found the issue. This is because your Xcode is not put in Applications folder. Move Xcode to this folder and enjoy.




回答2:


Make sure your .plist looks like this

<key>NSCameraUsageDescription</key>
<string>This app needs access to the camera to take photos.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app needs access to photos.</string>

And also if you disabled any changes to photo library privacy in your restrictions your app won't be able to use your photo library (it won't even ask for permission) until you turn off restrictions.




回答3:


Try to delete the simulator in ~/Library/Developer/CoreSimulator/Devices/xxxxx-xxx-xxxx, and copy a new one from other machine



来源:https://stackoverflow.com/questions/40386819/ios-simulator-permission-denied-and-not-showing-permission-alert-dialog

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