X-code升级X-code8后调用系统的麦克风、相机、相册、通讯录、定位等权限时,没在info.pilst加入对应的key的时候后台会打印如下:
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文件添加相应权限的说明,否则程序在iOS10上会出现崩溃
下面给的是调用对应权限相对应的key
麦克风权限:Privacy - Microphone Usage Description
相机权限: Privacy - Camera Usage Description
相册权限: Privacy - Photo Library Usage Description
通讯录权限: Privacy - Contacts Usage Description
蓝牙权限:Privacy - Bluetooth Peripheral Usage Description
语音转文字权限:Privacy - Speech Recognition Usage Description
日历权限:Privacy - Calendars Usage Description
定位权限:Privacy - Location When In Use Usage Description
定位权限: Privacy - Location Always Usage Description
例子
如要调用相册是要在info.plist文件中加权限:
未命名.png
后面的值是给用户调用功能的提示
如这样写:
未命名.png
网友评论