我使用 Ionic 3 为 iOS 开发了一个使用地理定位的应用程序。该应用程序被拒绝了,我需要更改应用程序对位置消息的请求。
我在 cordova 地理定位插件页面中提到了 iOS 怪癖,但运气不好:
<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
<string>need location access to find things nearby</string>
</edit-config>
我尝试了另一个变量NSLocationAlwaysUsageDescription
,以及两个变量。我卸载并重新安装地理定位插件。我尝试了很多“类似”问题的答案,但似乎没有任何效果。
注意事项:
- 我也使用 BackgruondGeolocation 插件。
部分套餐
“@ionic-native/background-geolocation”: “^4.12.2”, “@ionic-native/core”:“~4.11.0” “@ionic-native/geolocation”:“^4.12.0”, …… “ ionic 角度”:“3.9.2”
我注意到,如果我添加
<edit-config>
条目位于<platform name="ios">
末尾它在构建时给我一个冲突消息,但它结束了,如果它在开始时没有消息。无论哪种方式都不起作用。
请有人帮助我。
最佳答案
根据documentation ,您必须将此 key 添加到您的 Info.plist 中:
NSLocationWhenInUseUsageDescription
、NSLocationAlwaysAndWhenInUseUsageDescription
和 NSLocationAlwaysUsageDescription
You are required to include the NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription keys in your app's Info.plist file. (If your app supports iOS 10 and earlier, the NSLocationAlwaysUsageDescription key is also required.) If those keys are not present, authorization requests fail immediately.
关于ios - ionic 3 - iOS 策略位置权限模式警报消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52977576/