This app has crashed because it attempted to access privacy-sensitive data without a usage descripti

来源:互联网 发布:什么叫手机网络病毒 编辑:程序博客网 时间:2024/05/20 01:34


运行时报错如下:

This app has crashed because it attempted to access privacy-sensitive data without a usage description.  The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.


这是因为iOS10之后权限的问题导致崩溃。

解决方法:在项目中找到info.plist文件,右击有个 Open As,以Source Code 的形式打开,如图



打开后添加权限代码就可以了,添加什么权限代码可查看报错日志,里面说缺少NSPhotoLibraryUsageDescription这个权限添加如下代码既可以了,以后此类问题都可以这样解决。

<key>NSPhotoLibraryUsageDescription</key>

<string>photoLibraryUsageDescription</string>




下面其他的部分权限代码。

<key>NSMicrophoneUsageDescription</key>

<string>microphoneDesciption</string>

<key>NSCameraUsageDescription</key>

<string>cameraDesciption</string>

<key>NSPhotoLibraryUsageDescription</key>

<string>photoLibraryDesciption</string>

0 1
原创粉丝点击