在iOS11中,蘋果似乎增加了另一個隱私功能。
用戶現在可以覆蓋我們requestAlwaysAuthorization并將其降級為
requestWhenInUseAuthorization
- 這意味著作為開發人員,我們現在必須提供這兩個描述
Info.plist我發現他們添加了一個新的密鑰
NSLocationAlwaysAndWhenInUseUsageDescription
/** Either the NSLocationAlwaysAndWhenInUseUsageDescription key or both the* NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription* keys must be specified in your Info.plist; otherwise, this method will do* nothing, as your app will be assumed not to support Always authorization.*/
然而,使用這個新的密鑰 - 位置服務仍然沒有工作,進一步的搜索,我發現這個寶石混合了所有額外的調試信息:
此應用程序嘗試訪問隱私敏感數據,而無需使用說明。
應用程序的Info.plist必須包含
NSLocationAlwaysAndWhenInUseUsageDescription 和NSLocationWhenInUseUsageDescription 鍵,
其中字符串值向用戶解釋應用程序如何使用此數據這與我在更新的
CLLocationManager.h 文件中發現的評論直接相矛盾。所以我創造了一個測試項目好消息,如果您按照調試控制臺的建議添加新密鑰
NSLocationAlwaysAndWhenInUseUsageDescription和舊密鑰之一NSLocationWhenInUseUsageDescription,位置服務將再次開始工作。