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


运行时报错如下:

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 的形式打开,如图

This app has crashed because it attempted to access privacy-sensitive data without a usage descripti_第1张图片


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

NSPhotoLibraryUsageDescription

photoLibraryUsageDescription




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

NSMicrophoneUsageDescription

microphoneDesciption

NSCameraUsageDescription

cameraDesciption

NSPhotoLibraryUsageDescription

photoLibraryDesciption

你可能感兴趣的:(报错总结)