iOS10 裡面適配許可權Crash的問題
阿新 • • 發佈:2019-01-07
最近在看類似微信朋友圈的實現,從網上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>
控制檯會有相關的提示,缺少哪個許可權,新增哪個就好了~