在2016年秋季发布会iOS 10 及iPhone 7/7plus,以及XCODE 8, 如果是iOS 开发者就会发现如果项目中要使用到位置,相机,相册等等的时候,程序会崩溃,日志上会打印:
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.
其实这就是xcode 8 要求开发者需要到info.plist文件添加访问描述,如果没有添加就会出现程序崩溃.以下就是开发中如果访问用户的一些隐私方面的功能时需要添加的描述:
<key>NSAppleMusicUsageDescription</key>
<string>是否允许访问音乐</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>是否允许访问蓝牙</string>
<key>NSCalendarsUsageDescription</key>
<string>是否允许访问日历</string>
<key>NSCameraUsageDescription</key>
<string>是否允许访问相机</string>
<key>NSContactsUsageDescription</key>
<string>是否允许联系人</string>
<key>NSHealthShareUsageDescription</key>
<string>是否允许健康分享</string>
<key>NSHealthUpdateUsageDescription</key>
<string>是否允许健康更新</string>
<key>NSHomeKitUsageDescription</key>
<string>是否允许访问智能家居</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>是否允许一直访问位置</string>
<key>NSLocationUsageDescription</key>
<string>是否允许访问位置</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>是否允许试用期间访问位置</string>
<key>NSMicrophoneUsageDescription</key>
<string>是否允许访问麦克风</string>
<key>NSMotionUsageDescription</key>
<string>是否允许运动记录</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>是否允许相册</string>
<key>NSRemindersUsageDescription</key>
<string>是否允许访问备忘录</string>
<key>NSSiriUsageDescription</key>
<string>是否允许访问siri</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>是否允许访问语音</string>
<key>NSVideoSubscriberAccountUsageDescription</key>
<string>是否允许视频</string>
网友评论