ios 10问题的解决方法
发布日期:2021-11-10 08:20:49 浏览次数:1 分类:技术文章

本文共 2556 字,大约阅读时间需要 8 分钟。

1、iOS10相册相机闪退bug:

  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.

  修复方法:

(1)在info.plist文件下添加一下代码:

  相机权限

  <key>NSCameraUsageDescription</key>

  <string>cameraDesciption</string>

  相册权限

  <key>NSPhotoLibraryUsageDescription</key>

  <string>photoLibraryDesciption</string>

在网上还有一个说法,跟上述几乎一样只不过多设置了两项权限:

 (2)你需要在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>

2、iOS10因苹果健康导致闪退crash

  如果在app中调用了苹果健康,iOS10中会出现闪退。控制台报错的原因是:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSHealthUpdateUsageDescription must be set in the app's Info.plist in order to request write authorization.'

这是因为我们要在info.plist文件中声明苹果的使用权限,所以在info.plist中添加一下key就可以l

  请求写入:

  <key>NSHealthUpdateUsageDescription</key>

  <string>some string value stating the reason</string>

  请求读取

    <key>NSHealthShareUsageDescription</key>

      <string>some string value stating the reason</string>

另外附加一些其他权限描述:

  相机权限描述:

  <key>NSCameraUsageDescription</key>

    <string>cameraDesciption</string>

  通讯录

   <key>NSContactsUsageDescription</key> 

   <string>contactsDesciption</string>

  麦克风

  <key>NSMicrophoneUsageDescription</key>  

  <string>microphoneDesciption</string>

  相机

  <key>NSPhotoLibraryUsageDescription</key>

     <string>photoLibraryDesciption</string>

3、iOS10配置须知

  在iOS10中,如果你的App想要访问用户的相机、相册、麦克风、通讯录等等权限,都需要进行相关的配置,不然会直接crash。

需要在info.plist中添加App需要的一些设备权限。

  NSBluetoothPeripheralUsageDescription

  访问蓝牙

  NSCalendarsUsageDescription

  访问日历

  NSCameraUsageDescription

  相机

  NSPhotoLibraryUsageDescription

  相册

  NSContactsUsageDescription

  通讯录

  NSLocationAlwaysUsageDescription

  始终访问位置

  NSLocationUsageDescription

  位置

  NSLocationWhenInUseUsageDescription

  在使用期间访问位置

  NSMicrophoneUsageDescription

  麦克风

  NSAppleMusicUsageDescription

  访问媒体资料库

  NSHealthShareUsageDescription

  访问健康分享

  NSHealthUpdateUsageDescription

  访问健康更新

  NSMotionUsageDescription

  访问运动与健身

  NSRemindersUsageDescription

  访问提醒事项

暂时先总结这么多,继续搜集……

停下休息的时候不要忘记别人在奔跑!

转载地址:https://blog.csdn.net/cxiao_11/article/details/52808097 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Xcode8打包APP上传到APPStore遇到的问题
下一篇:如何规避苹果审查,实现app store上的app版本强制更新

发表评论

最新留言

关注你微信了!
[***.104.42.241]2024年03月05日 05时09分31秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章

android时间更新,Android 时间更新机制之网络更新时间 2019-04-21
lifull home android,‎App Store 上的“LIFULL HOME'S” 2019-04-21
android fmod,Android利用Fmod仿QQ变声音效 2019-04-21
signature=29c90d1a8d382ff261d00a931708390a,发烧音响功放(顶级Hi-End音响发烧器材介绍)... 2019-04-21
点灯游戏的html编程,index.html 2019-04-21
html 免费站点,28个免费的HTML5网站模板 2019-04-21
html 关闭页面回调,popup.js弹出层回调关闭 2019-04-21
flask 动态模板html,Flask:呈现模板并填充HTML选项卡 2019-04-21
html把分页改成滚动条,基于JavaScript实现表格滚动分页 2019-04-21
html tab顶部吸附,浅谈react.js中实现tab吸顶效果的问题 2019-04-21
python画图猪_用Python的turtle画一只小猪乔治【刚学python两天,记念一下】 2019-04-21
loadrunner常用函数_LoadRunner常用函数之--stricmp 函数,完成2个字符串的比较 2019-04-21
pytorch tensor 初始化_PyTorch简明笔记[1]-Tensor的初始化和基本操作 2019-04-21
linux正向连接shell_[经验] Linux 怎么连接 Xshell? 2019-04-21
nc 监听数据_nc命令使用解析大全 2019-04-21
简述tcp协议三报文握手过程_TCP协议中的三次握手和四次挥手(图解) 2019-04-21
手机键鼠映射软件_吃鸡,我最专业!---盖世小鸡键鼠吃鸡套装评测 2019-04-21
easyui datagrid 中怎么选中所有页面的数据_学会这5个Excel中常用技巧,可以准时下班去摆摊了... 2019-04-21
maskrcnn还可以加网络吗_绿茶加蜂蜜的功效,绿茶可以加蜂蜜吗? 2019-04-21
marquee滚动起始位置_巧用喵影关键帧制作滚动水印,让视频小偷无可盗 2019-04-21