近期公司項(xiàng)目安全整改,應(yīng)用內(nèi)獲取系統(tǒng)權(quán)限都要報(bào)備并說明用途,所以就在info.plist文件中刪除了部分沒用的權(quán)限,下次就不用報(bào)備了。今天新版本發(fā)布打包成功,上傳成功,但是沒審核通過。
問題如下
Dear Developer,
We identified one or more issues with a recent delivery for your app, "xxx". Please correct the following issues, then upload again.
Missing Purpose String in Info.plist File - Your app's code references one or more APIs that access sensitive user data. The app's Info.plist file should contain a NSContactsUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting Spring 2019, all apps submitted to the App Store that access user data will be required to include a purpose string. If you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK and request they release a version of their code that doesn't contain the APIs. Learn more (https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).
大致意思是應(yīng)用或SDK用到通訊錄API,但是缺少NSContactsUsageDescription權(quán)限和描述信息。
如何定位哪里用到了通訊錄API及解決審核禮包問題呢?
在代碼中刪除通訊錄依賴庫Contancts.framework、AddressBook.framework,然后運(yùn)行
1、包含有通訊錄API運(yùn)行后會(huì)報(bào)錯(cuò),就可以定位到具體方法及用途。

在info.plist中添加如下:
<key>NSContactsUsageDescription</key>
<string>需要您的同意,才能訪問通訊錄</string>
2、如果刪除依賴庫運(yùn)行沒有報(bào)錯(cuò),重新打包上傳即可
總結(jié)
刪除隱私權(quán)限之前最好提前檢查代碼中或第三方SDK是否使用到相關(guān)API,否則發(fā)布升級(jí)浪費(fèi)幾次打包時(shí)間。