GitHub user obione86 opened a pull request:
https://github.com/apache/cordova-plugin-geolocation/pull/83
CB-11962: (ios) Added variable NSLocationWhenInUseUsageDescription to
Config.xml
<!--
Please make sure the checklist boxes are all checked before submitting the
PR. The checklist
is intended as a quick reference, for complete details please see our
Contributor Guidelines:
http://cordova.apache.org/contribute/contribute_guidelines.html
Thanks!
-->
### Platforms affected
iOS
### What does this PR do?
Modifies plugin.xml to provide the value for
NSLocationWhenInUseUsageDescription using a variable which can then be set in
the plugin entry in the config.xml file rather than having to physically edit
the plugin.xml file. cordova-plugin-contacts and cordova-plugin-camera follow
the same strategy.
### What testing has been done on this change?
```
cordova create hello com.example.hello HelloWorld
$ cd hello
$ cordova platform add ios âsave
$ cordova plugin add
https://github.com/obione86/cordova-plugin-geolocation.git --variable
GEOLOCATION_USAGE_DESCRIPTION="Thought it might be good to have a nosey" --save
```
Navigate to plugins\cordova-plugin-geolocation\plugin.xml and check the
bottom of the ios section and it looks like this
<preference name="GEOLOCATION_USAGE_DESCRIPTION" default=" " />
<config-file target="*-Info.plist"
parent="NSLocationWhenInUseUsageDescription">
<string>$GEOLOCATION_USAGE_DESCRIPTION</string>
</config-file>
Open config.xml and the plugin section should have this
<plugin name="cordova-plugin-geolocation"
spec="https://github.com/obione86/cordova-plugin-geolocation.git">
<variable name="GEOLOCATION_USAGE_DESCRIPTION" value="Thought it
might be good to have a nosey" />
</plugin>
`$ cordova build ios`
Open platforms\ios\HelloWorld\HelloWorld-Info.plist and it should have
<key>NSLocationWhenInUseUsageDescription</key>
<string>Thought it might be good to have a nosey</string>
### Checklist
- [ ] [Reported an issue](http://cordova.apache.org/contribute/issues.html)
in the JIRA database
- [ ] Commit message follows the format: "CB-3232: (android) Fix bug with
resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform
affected.
- [ ] Added automated test coverage as appropriate for this change.
CB-11962: (ios) The NSLocationWhenInUseUsageDescription is required when
using geolocation but at the moment is always set to an empty string. This
commits adds a variable so that this value can be set in the config.xml file.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/obione86/cordova-plugin-geolocation master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cordova-plugin-geolocation/pull/83.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #83
----
commit 79fc000a503d07ffdf395d30f5e2731b9790df63
Author: obione <[email protected]>
Date: 2016-10-05T05:14:32Z
Added variable NSLocationWhenInUseUsageDescription
The NSLocationWhenInUseUsageDescription is required when using geolocation
but at the moment is always set to an empty string. This commits adds a
variable so that this value can be set in the config.xml file.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]