flutter-geolocator icon indicating copy to clipboard operation
flutter-geolocator copied to clipboard

Cannot request Always permission in iOS

Open vasiltabakov opened this issue 3 years ago • 3 comments

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

vasiltabakov avatar Nov 06 '21 11:11 vasiltabakov

I am also facing this issue.

Steps to reproduce:

  1. Configure your iOS Info.plist file only with the key NSLocationAlwaysAndWhenInUseUsageDescription.
  2. In dart call Geolocator.requestPermission()
  3. 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.

JulianBissekkou avatar Apr 29 '22 09:04 JulianBissekkou

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

ycherniavskyi avatar Mar 16 '23 13:03 ycherniavskyi

can anyone handle this issue?

nzackoya avatar Nov 22 '23 20:11 nzackoya