今天打包提交,收到了蘋果的退信,核心內容是這樣的:
This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSBluetoothPeripheralUsageDescription 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. Once these issues have been corrected, you can then redeliver the corrected binary.
翻譯過來就是:App 訪問了隱私相關數據,但 Info.plist 裡沒有對應的用途說明。修好之後重新提交即可。
右鍵點擊 Info.plist → Open As → Source Code,把下面用到的字段粘進去,描述文字按自己的實際場景填寫:
<key>NSVideoSubscriberAccountUsageDescription</key> <string></string> <key>NSBluetoothPeripheralUsageDescription</key> <string>藍牙權限</string> <key>NSSpeechRecognitionUsageDescription</key> <string>語音識別權限</string> <key>NSMicrophoneUsageDescription</key> <string>麥克風權限</string> <key>NSSiriUsageDescription</key> <string>Siri 權限</string> <key>NSRemindersUsageDescription</key> <string></string> <key>NSPhotoLibraryUsageDescription</key> <string>相冊權限</string> <key>kTCCServiceMediaLibrary</key> <string></string> <key>NSMotionUsageDescription</key> <string>運動權限</string> <key>NSAppleMusicUsageDescription</key> <string>音樂權限</string> <key>NSLocationUsageDescription</key> <string>地理位置權限</string> <key>NSLocationWhenInUseUsageDescription</key> <string>地理位置權限</string> <key>NSLocationAlwaysUsageDescription</key> <string>地理位置權限</string> <key>NSHomeKitUsageDescription</key> <string></string> <key>NSHealthUpdateUsageDescription</key> <string>健康權限</string> <key>NSHealthShareUsageDescription</key> <string>健康權限</string> <key>NSContactsUsageDescription</key> <string>通訊錄權限</string> <key>NSCameraUsageDescription</key> <string>攝像頭權限</string> <key>NSCalendarsUsageDescription</key> <string>日歷權限</string>
iOS 10 收緊了隱私策略。從 iOS 10 起,只要 App 鏈接的系統版本不低於 10.0,任何對隱私資源的訪問都必須「靜態聲明意圖」。少了對應的 purpose string,App 不是拒絕執行,而是直接終止——本地調試時就會崩潰,Archive 上傳則會被退回。
更隱蔽的一種情況是:某些第三方 SDK 內部會用到相機、藍牙或定位,即使你自己的代碼完全沒碰過這些 API,蘋果在靜態掃描時發現調用鏈存在,一樣會判定違規。這也是很多項目在加入推送、掃碼、Beacon 相關庫之後突然被拒的原因。
只添加真正用到的字段。把所有權限一次性全填進去雖然能過審,但描述寫得含糊或與實際功能不符,同樣可能被質疑,甚至在後續版本審核中被要求說明。
描述文字要說清「為什麼需要」而不只是「需要什麼」。比如相機權限寫「用於掃描二維碼添加好友」,比寫「相冊權限」更容易通過人工審核。
改完之後先在真機上把涉及的功能跑一遍,確認不再崩潰,再重新 Archive 上傳。