iOS 10對(duì)于隱私數(shù)據(jù)保護(hù)又一步加強(qiáng):
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.
就是說(shuō)在訪問(wèn)用戶數(shù)據(jù)時(shí)都需要在Info.plist中進(jìn)行聲明娶牌,否則就崩潰奔浅。
需要聲明的數(shù)據(jù)權(quán)限如下圖所示:
常用的有: 通訊錄 媒體庫(kù) 相冊(cè) 相機(jī) 麥克風(fēng) 地理位置
在plist中加入字段之后如下所示:
<key>NSPhotoLibraryUsageDescription</key>
<string</string>
<key>NSCameraUsageDescription</key>
<string></string>
<key>NSMicrophoneUsageDescription</key>
<string></string>
Value字段可以為空, 如果有值會(huì)在獲取權(quán)限彈窗中顯示
注意: 在iOS10 正式發(fā)布之后 該字段Value不得為空,否則提交的構(gòu)建版本,在iTunesconnect上無(wú)法看見(jiàn),同時(shí)接受到郵件:
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.
添加時(shí), 輸入 "Privacy"下部就會(huì)有所有的提示