引言
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中聲明,否則會crash,這些用戶數據包括:
Contacts(聯系人), Calendar(日歷), Reminders(提醒), Photos(照片), Bluetooth Sharing(藍牙), Microphone(麥克風), Camera(相機), Location(地理位置), Health(健康), HomeKit(家庭套件), Media Library(媒體圖書館), Motion(運動), CallKit, Speech Recognition(語音識別), SiriKit, TV Provider(電視提供商).
- 以下是開發常用的隱私權限聲明
1.相冊,相機
Privacy - Photo Library Usage Description //相冊
Privacy - Camera Usage Description //相機
2.麥克風,通訊錄
Privacy - Microphone Usage Description //麥克風
Privacy - Contacts Usage Description //通訊錄
3.定位
Privacy - Location Always Usage Description //持續定位
Privacy - Location When In Use Usage Description //使用應用時定位