iOS 10对于隐私数据保护又一步加强:
You must statically declare your app’s intended use of protected data classes by including the appropriate purpose string keys in your Info.plist file.
就是说在访问用户数据时都需要在Info.plist中进行声明,否则就崩溃。
需要声明的数据权限如下图所示:
常用的有: 通讯录 媒体库 相册 相机 麦克风 地理位置
在plist中加入字段之后如下所示:
<key>NSPhotoLibraryUsageDescription</key>
<string</string>
<key>NSCameraUsageDescription</key>
<string></string>
<key>NSMicrophoneUsageDescription</key>
<string></string>
Value字段可以为空, 如果有值会在获取权限弹窗中显示
注意: 在iOS10 正式发布之后 该字段Value不得为空,否则提交的构建版本,在iTunesconnect上无法看见,同时接受到邮件:
We have discovered one or more issues with your recent delivery for "***". To process your delivery, the following issues must be corrected:
This app attempts 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.
添加时, 输入 "Privacy"下部就会有所有的提示