最近在看类似微信朋友圈的实现,从网上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>
控制台会有相关的提示,缺少哪个权限,添加哪个就好了~