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. BZOJ 1109 [POI2007]堆积木Klo(树状数组)

    [题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=1109 [题目大意] Mary在她的生日礼物中有一些积木.那些积木都是相同大小的立方体. ...

  2. [ARC057D]全域木

    题意:求有多少个边权为$1\cdots\frac{n(n-1)}2$的完全图的最小生成树的边权为$a_{1\cdots n-1}$ 啊啊啊我tm真的是什么都不会啊 考虑kruskal的过程:每次选取跨 ...

  3. 【BFS】bzoj1054 [HAOI2008]移动玩具

    暴搜吧,可以哈希一下,但是懒得写哈希了,所以慢得要死. Code: #include<cstdio> #include<queue> #include<set> # ...

  4. 20162312 实验一 Linux基础与Java开发环境

    实 验 报 告 课程:程序设计与数据结构 姓名:张家铖 班级:1623 学号:20162312 实验名称: Linux基础与Java开发环境 实验器材:msi GL62M 7RD 实验目的与要求:1. ...

  5. Java学习笔记(8)

    static修饰方法(静态的成员方法): 访问方式: 可以使用对象进行访问                   对象.静态函数名(): 可以使用类名进行访问                   类名. ...

  6. xml和集合混合使用-图书管理器

    package com.book; public class Book { private int id; //图书编号 private String name; //图书名称 private Str ...

  7. CentOS 6.9使用iptables搭建网关服务器(转)

    条件: 网关服务器IP:172.16.0.1,并且可以连接到外网 客户端IP:172.16.0.0/24 1.开启转发支持forward /etc/sysctl.conf net.ipv4.ip_fo ...

  8. Migrating Oracle on UNIX to SQL Server on Windows

    Appendices Published: April 27, 2005 On This Page Appendix A: SQL Server for Oracle Professionals Ap ...

  9. 拍拍CPS入门使用

    1.新建应用,获取应用相应的appOAuthID.appOAuthKey.accessToken(这个一点击获取就会改变的,而且最长有效期为3个月,失效了需要重新获取) http://fuwu.pai ...

  10. Netty游戏服务器之三搭建Unity客户端

    既然已经写完了相关的服务器处理类,那么我们就来搭建客户端测试一下. 打开我们的unity3d,然后新建一个c#脚本,取名为MainClient. public class MainClient : M ...