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

[Regression]: iOS now requires to obtain "When in use" location permission before requesting "Always" location permission

Open AlanJereb opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

Please select affected platform(s)

  • [ ] Android
  • [X] iOS
  • [ ] Windows

Old behavior

Old versions of the plugin worked as intended.

Current behavior

iOS now requests to obtain "When in use" location permission before requesting "Always" location permission

PlatformException: MISSING_WHENINUSE_PERMISSION, Must have "When in use" permission before it is allowed to request "Always" permission

iOS version: 17.4.1 phone: iPhone 13 Pro Max flutter doctor's output:

[✓] Flutter (Channel stable, 3.19.6, on macOS 13.6.3 22G436 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.88.1)
[✓] Connected device (3 available)            
    ! Error: Browsing on the local area network for ES6. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for Luka’s iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as
      this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

• No issues found!

Steps to reproduce

  1. call Permission.locationAlways.request() before obtaining the "When in use" location permission

Code sample

Code sample
      if (Platform.isIOS) {
        await Permission.locationAlways.request();
      } 

Screenshots or video

Screenshots or video demonstration

Screenshot 2024-05-24 at 10 31 26

Current version

11.3.1

Last version without regression

11.3.0

AlanJereb avatar May 24 '24 08:05 AlanJereb

Dear @AlanJereb,

Thanks for filing the issue. I think I'll label this as an enhancement for documentation. I think its the responsibility of the developer to catch the exception and act upon it. However, we could describe the case in the documentation.

Kind regards,

TimHoogstrate avatar Aug 19 '24 14:08 TimHoogstrate