[ 
https://issues.apache.org/jira/browse/CB-11962?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15550970#comment-15550970
 ] 

ASF GitHub Bot commented on CB-11962:
-------------------------------------

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.

----


> NSLocationWhenInUseUsageDescription in Info.plist is always empty and gets 
> reset to empty whenever the app is built. This improves the process of adding 
> the plugin so that the value is always set
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CB-11962
>                 URL: https://issues.apache.org/jira/browse/CB-11962
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: Plugin Geolocation
>         Environment: iOS
>            Reporter: Obi Onuorah
>            Priority: Trivial
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> When the geolocation plugin is added using the command
> cordova plugin add cordova-plugin-geolocation
> no value is added in the plugin.xml file for the 
> NSLocationWhenInUseUsageDescription even though it is in there it is empty. 
> Updating this Key directly in the plist and it always gets reset to empty. 
> Updating it in the plugin.xml means removing and adding or updating the 
> plugins might overwrite the value.
> This fix simply adds it to the config.xml so that it can be specified on 
> installation using --variable or modified later by changing the value in the 
> config.xml, removing the plugin using cordova plugin rm and then running 
> cordova prepare which re-adds the plugin with the updated value of the key



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to