ios10 访问相机,照片crash问题

来源:互联网 发布:淘宝阴茎拉伸器 编辑:程序博客网 时间:2024/06/04 23:29

 iOS 10 升级后,坑还是挺多的,之前写的项目中照片访问就crash掉了

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.

解决问题是你需要在 info.plist 文件添加一个 NSPhotoLibraryUsageDescription的 key,然后添加一个描述。

下面是我对相册和相机添加的两条描述



下面是其他关于隐私添加有关权限问题的key

相机:<key>NSCameraUsageDescription</key>
<string>cameraDesciption</string>
联系人:<key>NSContactsUsageDescription</key>
<string>contactsDesciption</string>
麦克风:<key>NSMicrophoneUsageDescription</key>
<string>microphoneDesciption</string>
相册:<key>NSPhotoLibraryUsageDescription</key>
<string>photoLibraryDesciption</string>
其中这个string值可以随意写

1 0