jasdeepsaini commented on issue #173: (ios) Update README.md
URL: 
https://github.com/apache/cordova-plugin-geolocation/pull/173#issuecomment-539327957
 
 
   Since iOS 13 was released, Apple has rejected two of my non Cordova apps for 
requesting Allow Always permission when it was not needed.  In both cases I was 
using geofencing so Apple approved the apps after I explained my use case.
   
   In this plugin, the Allow Always permission is a fallback for when the 
`NSLocationWhenInUseUsageDescription` is missing in the plist file.  A better 
solution would be to get rid of the fallback and just ask users to ensure they 
specify the `NSLocationWhenInUseUsageDescription` permission string.
   
   This is the code I am referring to in CDVLocation.m starting at Line 119:
   ```
   #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
   ```
   
   Getting rid of the call to `requestAlwaysAuthorization` will save developers 
unnecessary rejections from Apple.

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


With regards,
Apache Git Services

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

Reply via email to