iOS 10的一大變化是更強的隱私數(shù)據(jù)保護。在文檔中是這么描述的:
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.
簡單的說訪問用戶數(shù)據(jù)都需要現(xiàn)在Info.plist中聲明究恤,否則會crash贩据。
這些用戶數(shù)據(jù)包括:
Contacts, Calendar, Reminders, Photos, Bluetooth Sharing, Microphone, Camera, Location, Health, HomeKit, Media Library, Motion, CallKit, Speech Recognition, SiriKit, TV Provider.
10之前只需要獲取位置時配置伦籍,現(xiàn)在更嚴格了,比如需要調(diào)用相冊訪問權(quán)限冈绊,也需要在Info.plist中配置privacy匙睹。
好在這些key的名字在Xcode 8中已經(jīng)有了自動補全。添加一個屬性瑟由,輸入Privacy后就會出現(xiàn)自動提示:
后面填的string會在彈出用戶允許時展示在描述里絮重。謝謝@Nidom提醒,如果描述空著提交AppStore時會拒絕歹苦。
歡迎關(guān)注我的微博:@沒故事的卓同學
相關(guān)鏈接:
原文:Privacy Settings in iOS 10
WWDC 2016 Session 709 Engineering Privacy for Your Users
Full list of Info.plist keys