slkerndnme closed pull request #106: CB-14085: Fix iOS usage description
URL: https://github.com/apache/cordova-plugin-geolocation/pull/106
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.travis.yml b/.travis.yml
index f3b108b..aec6a2e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -67,4 +67,4 @@ install:
 script:
 - npm test
 - node /tmp/paramedic/main.js --config pr/$PLATFORM --plugin $(pwd) 
--shouldUseSauce
-  --buildName travis-plugin-geolocation-$TRAVIS_JOB_NUMBER
+  --buildName travis-plugin-geolocation-$TRAVIS_JOB_NUMBER --force
diff --git a/README.md b/README.md
index a212a76..d43f4c7 100644
--- a/README.md
+++ b/README.md
@@ -156,19 +156,19 @@ error, the `geolocationError` callback is passed a
 
 ### iOS Quirks
  
- Since iOS 10 it's mandatory to provide an usage description in the 
`info.plist` if trying to access privacy-sensitive data. When the system 
prompts the user to allow access, this usage description string will displayed 
as part of the permission dialog box, but if you didn't provide the usage 
description, the app will crash before showing the dialog. Also, Apple will 
reject apps that access private data but don't provide an usage description.
+As precised in the (Apple 
documentation)[https://developer.apple.com/documentation/corelocation/choosing_the_authorization_level_for_location_services/requesting_always_authorization],
 this plugin requires the following usage descriptions to use the native 
location service:
 
- This plugins requires the following usage description:
+* `NSLocationAlwaysAndWhenInUseUsageDescription`
+* `NSLocationWhenInUseUsageDescription`
 
- * `NSLocationWhenInUseUsageDescription` describes the reason that the app 
accesses the user's location. 
-
- To add this entry into the `info.plist`, you can use the `edit-config` tag in 
the `config.xml` like this:
+By default, the usage description value for both entries is set as: "The 
application needs to access location data to make the user experience more 
efficient and reliable."
+                                                                    
+You can precise this value at installation:
 
 ```
-<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" 
mode="merge">
-    <string>need location access to find things nearby</string>
-</edit-config>
+cordova plugin add cordova-plugin-geolocation --variable USAGE_DESCRIPTION="My 
usage description"
 ```
+
  
 ### Android Quirks
 
diff --git a/plugin.xml b/plugin.xml
index de47684..358ef9e 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -66,6 +66,15 @@ xmlns:android="http://schemas.android.com/apk/res/android";
     <!-- ios -->
     <platform name="ios">
 
+        <!-- Location Usage Description -->
+        <preference name="USAGE_DESCRIPTION" default="The application needs to 
access location data to make the user experience more efficient and reliable." 
/>
+        <config-file parent="NSLocationAlwaysAndWhenInUseUsageDescription" 
target="*-Info.plist">
+            <string>$USAGE_DESCRIPTION</string>
+        </config-file>
+        <config-file parent="NSLocationWhenInUseUsageDescription" 
target="*-Info.plist">
+            <string>$USAGE_DESCRIPTION</string>
+        </config-file>
+
         <js-module src="www/Coordinates.js" name="Coordinates">
             <clobbers target="Coordinates" />
         </js-module>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to