xcode8 iOS10上關(guān)于NSPhotoLibraryUsageDescription NSCameraUsageDescription 等問(wèn)題

iOS 10出來(lái)之后,真是很多坑啊,填完一個(gè)又來(lái)一個(gè),今天又遇到了一個(gè),用Xcode8.0上傳項(xiàng)目時(shí)被駁回說(shuō)是info.plist里面沒(méi)有設(shè)置NSPhotoLibraryUsageDescription、NSCameraUsageDescription、NSContactsUsageDescription、NSMicrophoneUsageDescription等字段,之前這些都是預(yù)設(shè)的不用加,現(xiàn)在強(qiáng)制了,真是郁悶,下面貼上解決方案

被駁回的原因:

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.

This app attempts to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.

意思就是得在plist里面必須加上NSPhotoLibraryUsageDescription和NSCameraUsageDescription的鍵值對(duì)才行,之前都是默認(rèn)的,現(xiàn)在必須加,要不不讓通過(guò),具體配置如下圖:

info.png

也可以找到項(xiàng)目的info.plist文件,右擊選中Open As -> source code 添加如下代碼:
相機(jī)權(quán)限描述:

<key>NSCameraUsageDescription</key>
<string>cameraDesciption</string>

通信錄:

<key>NSContactsUsageDescription</key>
<string>contactsDesciption</string>

麥克風(fēng):

<key>NSMicrophoneUsageDescription</key>
<string>microphoneDesciption</string>

相機(jī):

<key>NSPhotoLibraryUsageDescription</key>
<string>photoLibraryDesciption</string>

其中,如果把<string>photoLibraryDesciption</string>中間photoLibraryDesciption去掉也可以,個(gè)人覺(jué)得更加簡(jiǎn)潔好看。

就這樣就解決權(quán)限問(wèn)題啦,不過(guò)如果實(shí)在還不行,你可以試試Clean,再運(yùn)行就OK啦

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容