flutter-geolocator
flutter-geolocator copied to clipboard
Cannot request Always permission in iOS
đ Bug Report
The app can never request 'always' permission in iOS.
Expected behavior
The app should be able to request 'always' permission in iOS
Version: 7.7.1
Platform: :iphone: iOS 14.4
This seems to be because of this: https://github.com/Baseflow/flutter-geolocator/blob/master/geolocator_apple/apple/Classes/Handlers/PermissionHandler.m#L56
It first checks if there's a "when in use" description. It should first check if there's "Always" or "When in use and always". If I remove the "When in use description" I get the following error in the debug log:
This app has attempted to access privacy-sensitive data without a usage description. The appâs Info.plist must contain both âNSLocationAlwaysAndWhenInUseUsageDescriptionâ and âNSLocationWhenInUseUsageDescriptionâ keys with string values explaining to the user how the app uses this data
Please fix this even if the Geolocator itself doesn't support background location. I'm using it to handle permissions and then use another plugin for background location updates.
I am also facing this issue.
Steps to reproduce:
- Configure your iOS Info.plist file only with the key
NSLocationAlwaysAndWhenInUseUsageDescription. - In dart call
Geolocator.requestPermission() - No dialog is shown
Why?
Before we call [locationManager requestAlwaysAuthorization] we check if NSLocationAlwaysAndWhenInUseUsageDescription is set, but according to apple docs for requestAlwaysAuthorization we have to set NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription.
Here is the exact error message output to the console when only NSLocationAlwaysAndWhenInUseUsageDescription is left in Info.plist:
This app has attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain both âNSLocationAlwaysAndWhenInUseUsageDescriptionâ and âNSLocationWhenInUseUsageDescriptionâ keys with string values explaining to the user how the app uses this data
can anyone handle this issue?