升级iOS
系统之后,突然发现经常闪退,最后决定用Xcode 8试一下
最近开发的项目涉及到定位,蓝牙,相机等功能,发现程序在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 NSContactsUsageDescription key with a string value explaining to the user how the app uses this data.
原来是相机的权限设置需要开发者 手动添加了,就和添加定位权限一样,
意思是说:你需要在info.plist文件 添加一个“NSContactsUsageDescription ”的Key,Value添加一个描述。
1,在项目中找到info.plist文件,右击有个 Open As,以Source Code 的形式打开
2,分别复制 以下 Value 和Key,Key 一定不能错,Value 貌似可以随便填写
相机权限描述:
<key>NSCameraUsageDescription</key>
<string>cameraDesciption</string>
通信录:
<key>NSContactsUsageDescription</key>
<string>contactsDesciption</string>
麦克风:
<key>NSMicrophoneUsageDescription</key>
<string>microphoneDesciption</string>
相机:
<key>NSPhotoLibraryUsageDescription</key>
<string>photoLibraryDesciption</string>
eg:其他权限描述,debug 控制台都会有输出的,自行添加就OK
3,Property List 的展现形式:
4,Clean之后,运行就OK了