更新了Xcode8 以及 iOS10,App访问用户的相机、相册、麦克风、通讯录的权限都需要重新进行相关的配置,不然在Xcode8中打开编译的话会直接crash。

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

相机NSCameraUsageDescription

相册NSPhotoLibraryUsageDescription

通讯录NSContactsUsageDescription

始终访问位置NSLocationAlwaysUsageDescription

位置NSLocationUsageDescription

在使用期间访问位置NSLocationWhenInUseUsageDescription

麦克风NSMicrophoneUsageDescription

访问蓝牙NSBluetoothPeripheralUsageDescription

访问日历NSCalendarsUsageDescription

访问媒体资料库NSAppleMusicUsageDescription

访问健康分享NSHealthShareUsageDescription

访问健康更新NSHealthUpdateUsageDescription

访问运动与健身NSMotionUsageDescription

访问提醒事项NSRemindersUsageDescription

提别提醒: 从2017年1月1日起,强制使用https,所有新提交的 app 默认不允许使用NSAllowsArbitraryLoads来绕过ATS的限制 安全传输不再支持SSLv3, 建议尽快停用SHA1和3DES算法.

下面贴出来错误:

Q1:  iOS10相册相机闪退问题:

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>

Q2:  iOS 10 因苹果健康导致闪退

如果在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就可以:

请求写入

<key>NSHealthUpdateUsageDescription<key>
<string>some string value stating the reason<string>

请求读取

<key>NSHealthShareUsageDescription<key>
<string>some string value stating the reasonPaste_Image.png<string>

Q3:  Xcode 打印的那些杂乱无章的bug

更新Xcode8之后,新建立工程,都会打印一堆莫名其妙看不懂的Log.比如如这些

subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level:0, persist_level:0, default_ttl:0, info_ttl:0, debug_ttl:0, generate_symptoms:0, enable_oversize:1,

屏蔽的方法如下:

Xcode8里边 Edit Scheme->Run-> Arguments, 在Environment Variables里边添加

OS_ACTIVITY_MODE = Disable 就行,截图如下:(真的没有iPhone4了)

弄完之后就可以像之前那样 正常打印了.

最新文章

  1. spring mvc异常统一处理(ControllerAdvice注解)
  2. 用Action的属性接受参数
  3. Azure 删除VHD时报错:There is currently a lease on the blob and no lease ID was specified in the request
  4. JMeter学习(一)工具简单介绍
  5. SQL Server 几种锁的区别
  6. log4j2配置
  7. eclipse使用
  8. Axis2/c 知识点
  9. (转载)Android content provider基础与使用
  10. Darwin Streaming Server Relay Setting
  11. 开发一个struts2的实例
  12. 2015第45周五IE11实用开发工具摘录及设置IE缓存
  13. Struts2获取request三种方法
  14. Demo_CS(移动,切换枪支,发射子弹)
  15. poj 3378 Crazy Thairs dp+线段树+大数
  16. thinkphp 操作xml格式
  17. iview 模态框点击确定按钮不消失
  18. 洛谷P3919 【模板】可持久化数组(可持久化线段树/平衡树)
  19. .net core 开发接口前端调用时提示错误 405
  20. php-fpm开机自动启动脚本其实源码包里边就有

热门文章

  1. [置顶] iOS中让省略号垂直居中
  2. How far away ?(DFS)
  3. OBD-II Protocol -- SAE J1850 VPW PWM
  4. [Asp.net MVC]页面伪静态实现
  5. go test
  6. mysql查询null异常:attempted to return null from a method with a primitive return type
  7. C#,数据类型扩展 z
  8. UITableViewCell状态切换效果
  9. 基于nginx实现protobuf RPC
  10. Android之等比例显示图片