flutterlocation icon indicating copy to clipboard operation
flutterlocation copied to clipboard

fix: Location service prompt not working on iOS 16

Open raviparmarr opened this issue 1 year ago • 1 comments

I have tried the same code as mention below and it's works fine on both Android and iOS (version below 16).

Location location = new Location();

bool _serviceEnabled; PermissionStatus _permissionGranted; LocationData _locationData;

_serviceEnabled = await location.serviceEnabled(); if (!_serviceEnabled) { _serviceEnabled = await location.requestService(); if (!_serviceEnabled) { return; } }

_permissionGranted = await location.hasPermission(); if (_permissionGranted == PermissionStatus.denied) { _permissionGranted = await location.requestPermission(); if (_permissionGranted != PermissionStatus.granted) { return; } }

_locationData = await location.getLocation();

  • location.serviceEnabled() is not working on iOS 16

raviparmarr avatar Apr 20 '23 05:04 raviparmarr

if you remove the background location from the info.plist it will work, don't ask why!

drissfoo avatar Nov 16 '23 23:11 drissfoo