iOS10系统下调用系统相册、相机功能,遇到闪退的情况,描述如下:

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文件下添加

相机权限

<key>NSCameraUsageDescription</key>

<string>cameraDesciption</string>

相册权限

<key>NSPhotoLibraryUsageDescription</key>

<string>photoLibraryDesciption</string>

===========================

说法二

升级iOS10之后,在应用访问相册、相机、话筒、听筒的时候会发生崩溃。例如访问相机的时候xcode打印崩溃信息:

“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.”

这是因为iOS对于隐私权限的配置更为严格。但是我看不出来哪里好了,用着还不方便。

解决办法:

更改info.plist文件,可以直接用文本打开,添加:

<key>NSCameraUsageDescription</key>
<string>cameraDesciption</string>
<key>NSContactsUsageDescription</key>
<string>contactsDesciption</string>
<key>NSMicrophoneUsageDescription</key>
<string>microphoneDesciption</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>photoLibraryDesciption</string>

也可以直接在xcode中更改:

这个string是我们开发者给起的一个表示,意思就是能随便写,但是要能表明其含义,它是给用户看的。第一次访问这些外设的时候会弹出提示框,上面就有显示这个string:

其它的权限key:

// 相机
NSCameraUsageDescription

// 相册
NSPhotoLibraryUsageDescription

// 麦克风:
NSMicrophoneUsageDescription

// 通信录
NSContactsUsageDescription

// 位置
NSLocationUsageDescription

// 日历
NSCalendarsUsageDescription

// 蓝牙
NSBluetoothPeripheralUsageDescription

// 媒体资料库
NSAppleMusicUsageDescription

// 提醒事项
NSRemindersUsageDescription

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

// 始终访问位置
NSLocationAlwaysUsageDescription

// 运动与健身
NSMotionUsageDescription

更多iOS10的特性参考官方文档:点击打开链接

==================================

iOS10闪退 崩溃1:

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.

意思是说:你需要在info.plist文件 添加一个“NSContactsUsageDescription ”的Key,Value添加一个描述。

需要在应用的info.plist里加入(使用source code模式):

<key>NSCameraUsageDescription</key>
<string>cameraDesciption</string>
<key>NSContactsUsageDescription</key>
<string>contactsDesciption</string>
<key>NSMicrophoneUsageDescription</key>
<string>microphoneDesciption</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>photoLibraryDesciption</string>

WDC2106 iOS10新特性及开发者要注意什么

iOS10相册相机闪退bug的更多相关文章

  1. iOS10相册相机闪退bug-b

    iOS10系统下调用系统相册.相机功能,遇到闪退的情况,描述如下: This app has crashed because it attempted to access privacy-sensit ...

  2. 解决关于ios访问相机闪退问题

    在mac上的ionic3项目打包成苹果app,系统版本是10.3.3 . 当调用相机的时候出现闪退情况,这是调试出现的问题: This app has crashed because it attem ...

  3. app保存图片到用户相册时闪退解决办法

    在iOS11中,app保存图片到用户相册时必须添加权限使用描述即NSPhotoLibraryAddUsageDescription,否则会闪退. 只需在info.plist—Property List ...

  4. cordova+vue打包ios调用相机闪退解决

    cordova+vue项目打包android,打开相机正常使用,但是打包ios后,需要多几个配置,才能打开,否则当调用的时候会闪退,上配置图 需要在选中的文件里面添加 <key>NSCam ...

  5. vs2017 .net core 项目调试浏览器网页闪退Bug

    from:https://blog.csdn.net/qq_36330228/article/details/82152187 vs更新2017最新版本后,项目调试浏览器莫名其妙出现闪退,每次都TMD ...

  6. 360浏览器导出Excel闪退BUG

    最近这半个月在疯狂的修改各种BUG,所以比较少更新博客. 现在谈谈这个360浏览器导出Excel的BUG的解决方法. 该BUG常出现在win7系统与xp系统导出Excel的瞬间关闭导出弹窗. 目前互联 ...

  7. Android 7.0 之后相机/文件读写等权限获取方式改变,导致开启相机闪退

    在 Android 7.0 之前 Google 提供的动态申请权限的 API,可以调用相机拍照,访问SDcard等操作都只需要申请对应的权限,如下: <uses-permission andro ...

  8. fastclick select 闪退 bug

    这时候needsclick就派上用场了 <select class='needsclick'></select> 附上fastclick github上的链接

  9. ios 真机使用相机闪退问题

    需要增加权限 在info文件增加 主要前面的key 后面的cameraDesciption只是一段描述 随便写就可以

随机推荐

  1. k-近邻算法 简单例子

    from numpy import * import operator def create_data_set(): # 训练集与标签 group = array([[1.0, 1.1], [1.0, ...

  2. Problem C: 零起点学算法93——矩阵转置

    #include<stdio.h> int main() { ][],b[][]; while(scanf("%d%d",&n,&m)!=EOF) { ...

  3. (小规模)b牌棋盘完美覆盖数

    (小规模)b牌棋盘完美覆盖数 考虑一个普通的国际象棋棋盘,它被分成8*8(8行8列)的64个正方形.设有形状一样的多米诺骨牌,每张牌恰好覆盖棋盘上相邻的两个方格(即1*2的骨牌).那么能否把32个这样 ...

  4. [转] SSH配置之web.xml

    在项目中总会遇到一些关于加载的优先级问题, 首先可以肯定的是,加载顺序与它们在 web.xml 文件中的先后顺序无关.即不会因为 filter 写在 listener 的前面而会先加载 filter. ...

  5. iOS \U6b3e转字符串

    -(NSString *)replaceUnicode:(NSString *)unicodeStr { NSString *tempStr1 = [unicodeStr stringByReplac ...

  6. 通过Chrome模拟和调试网速慢的情况来限制一些P2P视频网站上传速度占满的情况

  7. 迁移11g Rac中OCR和VOTEDISK

    环境:OEL+oracle rac 11.2.0.3 迁移描述:将ocr和votedisk从+DATE上迁移到+OCR_VOTE上: 操作如下: [root@ora2 ~]$ /u01/app/11. ...

  8. nodejs+mysql入门实例

    此前我已准备好mysql,使用的是PHP的组合包Appserv 手动添加数据库依赖: 在package.json的dependencies中新增, “mysql” : “latest”, { &quo ...

  9. Intents and Intent Filters

    An Intent is a messaging object you can use to request an action from another app component. Althoug ...

  10. Spark Streaming源码解读之流数据不断接收和全生命周期彻底研究和思考

    本节的主要内容: 一.数据接受架构和设计模式 二.接受数据的源码解读 Spark Streaming不断持续的接收数据,具有Receiver的Spark 应用程序的考虑. Receiver和Drive ...