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

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

jcesarmobile 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/README.md b/README.md
index a212a76..094a471 100644
--- a/README.md
+++ b/README.md
@@ -156,19 +156,18 @@ 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_when_in_use_authorization],
 this plugin requires the following usage description to use the native 
location service:
 
- This plugins requires the following usage description:
+* `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 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..32e148a 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -66,6 +66,12 @@ 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="NSLocationWhenInUseUsageDescription" 
target="*-Info.plist">
+            <string>$USAGE_DESCRIPTION</string>
+        </config-file>
+
         <js-module src="www/Coordinates.js" name="Coordinates">
             <clobbers target="Coordinates" />
         </js-module>
diff --git a/tests/plugin.xml b/tests/plugin.xml
index 50e7e77..f1a365c 100644
--- a/tests/plugin.xml
+++ b/tests/plugin.xml
@@ -29,7 +29,7 @@
     <dependency id="cordova-plugin-device" 
url="https://github.com/apache/cordova-plugin-device"; />
     <js-module src="tests.js" name="tests">
     </js-module>
-    <edit-config target="NSLocationWhenInUseUsageDescription" 
file="*-Info.plist" mode="merge">
-      <string>need location access to pass tests</string>
-    </edit-config>
+    <config-file parent="NSLocationWhenInUseUsageDescription" 
target="*-Info.plist">
+        <string>need location access to pass tests</string>
+    </config-file>
 </plugin>


 

----------------------------------------------------------------
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:
[email protected]


> cordova-plugin-geolocation no more working on iOS 11
> ----------------------------------------------------
>
>                 Key: CB-14085
>                 URL: https://issues.apache.org/jira/browse/CB-14085
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-geolocation
>    Affects Versions: cordova-android-7.0.0
>            Reporter: Gauthier Saison
>            Priority: Critical
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> The apache plugin cordova-plugin-geolocation is fully reliable on android but 
> now bugged on iOS caused by missed properties injections in the plist file:
> NSLocationAlwaysAndWhenInUseUsageDescription and 
> NSLocationWhenInUseUsageDescription have to be precised on [the offcial Apple 
> documentation|https://developer.apple.com/documentation/corelocation/choosing_the_authorization_level_for_location_services/requesting_always_authorization].
> Those entries can now be added directly on the plugin installation by 
> requesting a IOS_USAGE_DESCRIPTION variable.
> To fix this problem, a few lines has to be added on the plugin.xml, and the 
> readme has to be updated.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to