作者:百万会员XTN_859 | 来源:互联网 | 2023-01-17 17:05
我刚刚更新到Xcode 9.0正式版,当我运行使用位置服务的应用程序时,它工作正常但控制台打印出以下警告:
The app's Info.plist must contain both NSLocationAlwaysAndWhenInUseUsageDescription and NSLocationWhenInUseUsageDescription keys with string values explaining to the user how the app uses this data
所以我试图在我的Info.plist中添加以下密钥:
NSLocationAlwaysAndWhenInUseUsageDescription
This app needs your current location
但是当我再次尝试运行应用时,Xcode 9会显示一条警告:无法读取数据,因为数据格式不正确.
所以我切换回:
NSLocationAlwaysUsageDescription
该应用程序工作正常.哦,我的Info.plist已经包含了NSLocationWhenInUseUsageDescription键!
这是控制台中的Xcode 9错误吗?有人得到同样的警告吗?
1> xscoder..:
没关系,我通过简单地浏览和选择Info.plist中的正确隐私 - 位置使用选项- >打开为 - >属性列表视图来修复它,这里是在需要时插入Info.plist的正确键:
NSLocationAlwaysAndWhenInUseUsageDescription
This app needs your current location
NSLocationWhenInUseUsageDescription
This app needs your current location