iOS 10 APP调用摄像头导致的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,然后添加一个描述。

解决方案
1.在项目中找到info.plist文件,右键点击以 Source Code形式打开
2.添加以下键值对,这里以 PhotoLibrary 作为例子
<key>NSPhotoLibraryUsageDescription</key>
<string>此 App 需要您的同意才能读取媒体资料库</string>
注意,key 是绝对不能写错的,
而 value 也就是<string></string>你可以随意写

其它的权限key:

// 相机
NSCameraUsageDescription

// 相册
NSPhotoLibraryUsageDescription

// 麦克风:
NSMicrophoneUsageDescription

// 通信录
NSContactsUsageDescription

// 位置
NSLocationUsageDescription

// 日历
NSCalendarsUsageDescription 

// 蓝牙
NSBluetoothPeripheralUsageDescription

// 媒体资料库
NSAppleMusicUsageDescription

// 提醒事项
NSRemindersUsageDescription

// 在使用期间访问位置
NSLocationWhenInUseUsageDescription

// 始终访问位置
NSLocationAlwaysUsageDescription 

// 运动与健身
NSMotionUsageDescription

 

声明:本站所有文章和图片,如无特殊说明,均为原创发布,转载请注明出处。
随机推荐
JavaScript 原生拖放
JavaScript 事件
JavaScript 和 CSS 检测横屏适配
Git 从远程仓库拉取代码覆盖本地代码
WP_Query 函数参数
JavaScript 使用剪切板
Express 使用 cors 模块支持跨域
River 主题