當我們Xcode升級到8.0后,訪相機的設備會崩了并報錯:[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.
這是因為iOS 10后訪問系統權限,需要在info文件中添加相應字段用來提示訪問說明及用戶是否允許訪問,這樣無疑更合理而且提高了蘋果的逼格。
下面就列出一些常用的字段
麥克風權限:Privacy - Microphone Usage Description 是否允許此App使用你的麥克風?
相機權限: Privacy - Camera Usage Description 是否允許此App使用你的相機?
相冊權限: Privacy - Photo Library Usage Description 是否允許此App訪問你的媒體資料庫?
通訊錄權限: Privacy - Contacts Usage Description 是否允許此App訪問你的通訊錄?
藍牙權限:Privacy - Bluetooth Peripheral Usage Description 是否許允此App使用藍牙?
語音轉文字權限:Privacy - Speech Recognition Usage Description 是否允許此App使用語音識別?
日歷權限:Privacy - Calendars Usage Description
定位權限:Privacy - Location When In Use Usage Description
定位權限: Privacy - Location Always Usage Description
位置權限:Privacy - Location Usage Description
媒體庫權限:Privacy - Media Library Usage Description
健康分享權限:Privacy - Health Share Usage Description
健康更新權限:Privacy - Health Update Usage Description
運動使用權限:Privacy - Motion Usage Description
音樂權限:Privacy - Music Usage Description
提醒使用權限:Privacy - Reminders Usage Description
Siri使用權限:Privacy - Siri Usage Description
電視供應商使用權限:Privacy - TV Provider Usage Description
視頻用戶賬號使用權限:Privacy - Video Subscriber Account Usage Description
如下圖: