【发布时间】:2015-11-10 19:05:03
【问题描述】:
我正在使用 Cordova 构建一个移动应用程序。我使用cordova-plugin-geolocation 来获取用户的当前位置。要在 iOS 上自定义位置权限请求,需要设置 NSLocationWhenInUseUsageDescription plist 值。
通常,要设置 iOS plist 选项,需要手动设置 platforms/ios/<app-name>/<app-name>-Info.plist 中的选项值。问题在于,在每次构建时,cordova-plugin-geolocation 都会使用默认的空字符串覆盖自定义值。
猜测它与plugins/cordova-plugin-geolocation/plugin.xml 中的以下几行有关:
<config-file target="*-Info.plist" parent="NSLocationWhenInUseUsageDescription">
<string></string>
</config-file>
但是,如果我尝试在 <string> 中设置任何值,则不会受到尊重,因为在安装插件时,plugin.xml 似乎被缓存在某处。
因此,对于以在项目重建过程中持续存在的方式设置 NSLocationWhenInUseUsageDescription 的任何帮助,我们将不胜感激。
【问题讨论】: