This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.
NSCameraUsageDescription key这个应该是使用相机权限描述的问题,那就果断加上吧!
1.打开项目中Info.plist文件
2.右键选择 Add row,将NSCameraUsageDescription粘贴到key里,他会自动变为:Privacy - Camera Usage Description 。value的值可以不填,也可以填出你想要说的话,这个和位置权限描述是一样的原理(NSLocationUsageDescription /Privacy - Location When In Use Usage Description)
或者通过Source Code形式打开Info.plist 添加以下键值对
<key>NSCameraUsageDescription</key>
<string>cameraDesciption</string>
或者 输入 Privacy 可以迅速定位到这一权限系列,找到你需要的权限,修改后面的 value 就可以了
3.然后clean重新编译app,就可以成功了!
类似的还有这些常用的
NSPhotoLibraryUsageDescription
NSContactsUsageDescription
NSMicrophoneUsageDescription
或者
<key>NSPhotoLibraryUsageDescription</key>
<string>cameraDesciption</string>
<key>NSContactsUsageDescription</key>
<string>contactsDesciption</string>
<key>NSMicrophoneUsageDescription</key>
<string>microphoneDesciption</string>
如果想看全部相关的建议访问苹果官方Api
链接地址
网友评论