隐私权限崩溃
问题描述:
2016-09-19 00:30:54.612877 FileTransfer[2315:144494] [access] 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 中添加键值对,就像之前定位一样,需要提示用户,申请对应的隐私权限,添加到Info.plist 的内容如下:
<key>NSPhotoLibraryUsageDescription</key>
<string>这是在提示框中显示的文字</string>
或者直接在可视化界面,点击➕添加一个键值对,在键的一栏中输入 Privacy 可以找到对应的隐私关键字.相册对应的是Privacy - Photo Library Usage Description.
如下图:
提示框内容
PS: 其他的对应的参数,嵌入方式如上:
<key> NSCameraUsageDescription </key>
<string>相机</string>
<key> NSContactsUsageDescription </key>
<string>通讯录</string>
<key> NSMicrophoneUsageDescription </key>
<string>麦克风</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>相册</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>蓝牙</string>
<key>NSCalendarsUsageDescription</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>NSAppleMusicUsageDescription</key>
<string>音乐</string>
<key>NSMotionUsageDescription</key>
<string>时刻</string>
<key>kTCCServiceMediaLibrary</key>
<string>TV控制</string>
<key>NSRemindersUsageDescription</key>
<string>提醒</string>
<key>NSSiriUsageDescription</key>
<string>Siri</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>语音</string>
<key>NSVideoSubscriberAccountUsageDescription</key>
<string>视频</string>
网友评论