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

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

NiklasMerz edited a comment on issue #100: CB-13680: (android) First check for 
NSLocationAlwaysUsageDescription permission to make sure 
requestAlwaysAuthorization is fired instead of requestWhenInUseAuthorization
URL: 
https://github.com/apache/cordova-plugin-geolocation/pull/100#issuecomment-417595030
 
 
   I am setting a description via the variable GEOLOCATION_USAGE_DESCRIPTION. 
If I understand the warning correctly, Apple now requires apps with location 
access to set both decriptions.  
   
   After uploading the app to the app store apple sent an email with this 
warning:
   
   > "Missing Purpose String in Info.plist File. Your app's code references one 
or more APIs that access sensitive user data. The app's Info.plist file should 
contain a NSLocationAlwaysUsageDescription key with a user-facing purpose 
string explaining clearly and completely why your app needs the data. Starting 
spring 2019, all apps submitted to the App Store that access user data will be 
required to include a purpose string.If you're using external libraries or 
SDKs, they may reference APIs that require a purpose string. While your app 
might not use these APIs, a purpose string is still required. You can contact 
the developer of the library or SDK and request they release a version of their 
code that doesn't contain the APIs. Learn more 
(https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy)."
   

----------------------------------------------------------------
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 permission request going wrong in newer iOS version
> ------------------------------------------------------------------------------
>
>                 Key: CB-13680
>                 URL: https://issues.apache.org/jira/browse/CB-13680
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-geolocation
>         Environment: iOS
>            Reporter: Babette Stam
>            Priority: Minor
>             Fix For: Master
>
>
> When you want to request the always access location permissions the newer iOS 
> version requires that the NSLocationAlwaysUsageDescription and 
> NSLocationWhenInUseUsageDescription are both set. It is not allowed to only 
> set the NSLocationAlwaysUsageDescription anymore.
> But in the Cordova code there is a check that when you have the 
> NSLocationWhenInUseUsageDescription set, the application will only ask the 
> user permission to use the location in app usage 
> (requestWhenInUseAuthorization). It will run the requestAlwaysAuthorization.
> I saw a different issue reported 2 years ago with the question reversed 
> (CB-8826). This was then implemented, but is not working with the latest 
> version. The following code should be edited:
> {code:javascript}
> #ifdef __IPHONE_8_0
>     NSUInteger code = [CLLocationManager authorizationStatus];
>     if (code == kCLAuthorizationStatusNotDetermined && ([self.locationManager 
> respondsToSelector:@selector(requestAlwaysAuthorization)] || 
> [self.locationManager 
> respondsToSelector:@selector(requestWhenInUseAuthorization)])) { //iOS8+
>         __highAccuracyEnabled = enableHighAccuracy;
>         if([[NSBundle mainBundle] 
> objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"]){
>             [self.locationManager requestWhenInUseAuthorization];
>         } else if([[NSBundle mainBundle] 
> objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"]) {
>             [self.locationManager  requestAlwaysAuthorization];
>         } else {
>             NSLog(@"[Warning] No NSLocationAlwaysUsageDescription or 
> NSLocationWhenInUseUsageDescription key is defined in the Info.plist file.");
>         }
>         return;
>     }
> #endif
> {code}
> It should be: 
> {code:javascript}
> #ifdef __IPHONE_8_0
>     NSUInteger code = [CLLocationManager authorizationStatus];
>     if (code == kCLAuthorizationStatusNotDetermined && ([self.locationManager 
> respondsToSelector:@selector(requestAlwaysAuthorization)] || 
> [self.locationManager 
> respondsToSelector:@selector(requestWhenInUseAuthorization)])) { //iOS8+
>         __highAccuracyEnabled = enableHighAccuracy;
>         if([[NSBundle mainBundle] 
> objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"]) {
>             [self.locationManager  requestAlwaysAuthorization];
>         } else if([[NSBundle mainBundle] 
> objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"]){
>             [self.locationManager requestWhenInUseAuthorization];
>         } else {
>             NSLog(@"[Warning] No NSLocationAlwaysUsageDescription or 
> NSLocationWhenInUseUsageDescription key is defined in the Info.plist file.");
>         }
>         return;
>     }
> #endif
> {code}



--
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