flutter-permission-handler icon indicating copy to clipboard operation
flutter-permission-handler copied to clipboard

Got permanentlyDenied when location service is disabled

Open emersonsiega opened this issue 2 years ago • 11 comments

🐛 Bug Report

The Permission.locationWhenInUse.status method is returning permanentlyDenied if the location service was disabled in iPhone.

On Android it's working fine.

Expected behavior

I've created a logic in these steps:

  • Request permission status
  • If is denied, call my request permission method
  • My request permission method will check if service is disabled (if has a service)
  • If service is disabled, this method will return a specific error and, in some cases, I can request the user to enabled the service, opening the app settings

I believe that returning a permanentlyDenied status just for iOS is not correct. Should keep the same behavior for Android/iOS.

Reproduction steps

  1. Disable the iOS location service
  2. Request Permission.locationWhenInUse.status

Configuration

Version: 8.1.6

Platform:

  • [X] :iphone: iOS
  • [ ] :robot: Android

emersonsiega avatar Sep 21 '21 15:09 emersonsiega

I'm running into something similar; however, I didn't deny the location request. The app's permission is set to "While Using the App"; however, Permission.location.request() always returns permanentlyDenied.

This started after updating to 8.2.2 from 6.0.0. For now, I've reverted back to 6.1.3 and everything is working as expected.

cohenadair avatar Oct 10 '21 18:10 cohenadair

The same with await Permission.photos.request() return permanentlyDenied: ios 14.4

wwl901215 avatar Oct 12 '21 07:10 wwl901215

This is working again on version 8.2.5; iOS 15.0.

cohenadair avatar Nov 02 '21 20:11 cohenadair

Just tried with version 8.2.5 and got the same problem...

emersonsiega avatar Nov 03 '21 16:11 emersonsiega

@emersonsiega, what version of iOS are you testing on?

cohenadair avatar Nov 03 '21 17:11 cohenadair

iOS 14.8

emersonsiega avatar Nov 03 '21 17:11 emersonsiega

There were some changes in location permissions made in iOS 15. Perhaps those changes somehow fixed the issue with this plugin.

cohenadair avatar Nov 03 '21 17:11 cohenadair

any update on this? i still got this issue in iOS 15 using 9.2.0 version

andisoer avatar Aug 25 '22 07:08 andisoer

I'm resolving it by adding the following items to podfile: config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ '$(inherited)',

   ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
   'PERMISSION_LOCATION=1',

]

phanbaohuy96 avatar Sep 16 '22 02:09 phanbaohuy96

Any update? I still have an issue on iPhone 7 with iOS 15.4.1.

any update to this issue, still getting same errror permanentlyDenied

cyiboy avatar Oct 18 '23 13:10 cyiboy