最近在看類似微信朋友圈的實現,從網上down了一個不錯的demo,結果跑步起來,查了一下,發現是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 NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.
System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
Reading from public effective user settings.
看提示的意思是說 app的info.plist文件必須要有一個 NSPhotoLibraryUsageDescription的限制的鍵值對來描述app是如何來使用這些數據的。
找到info.plist文件;添加如下鍵值
<key>NSPhotoLibraryUsageDescription</key>
<string>此 App 需要您的同意才能讀取媒體資料庫</string>
注意:key值是privacy的類型的是系統的,value是對這個的描述,可以隨便寫什麼都可以,你寫的描述,其實就是到時候系統在需要用到這些權限的時候會給用戶彈框提醒的內容;
一般正常能用到的大體上有這幾種:
<key>NSCameraUsageDescription</key>
<string>cameraDesciption</string>
<key>NSContactsUsageDescription</key>
<string>contactsDesciption</string>
<key>NSMicrophoneUsageDescription</key>
<string>microphoneDesciption</string>
控制檯會有相關的提示,缺少哪個權限,添加哪個就好了~