Baseflow / Baseflow/flutter-permission-handler

[Bug]: iOS: Permission.criticalAlerts.request() does always return PermissionStatus.granted on the first request

Open
#1,284 3 comments 1 reaction 1 assignee Claimed by @TimHoogstrate View on GitHub
Dominant language
Dart
Stars
2.2k
Forks
970
Avg merge
14h 22m
Merged PRs (30d)
2

Description

### Please check the following before submitting a new issue.

- [X] I have searched the [existing issues](https://github.com/baseflow/flutter-permission-handler/issues).
- [x] I have carefully [read the documentation](https://github.com/Baseflow/flutter-permission-handler/blob/main/permission_handler/README.md) and verified I have added the required platform specific configuration.

### Please select affected platform(s)

- [ ] Android
- [X] iOS
- [ ] Windows

### Steps to reproduce

1. request critical alert permission on iOS with `await Permission.criticalAlerts.request();` for the first time
2. A iOS dialog is shown. Press "do not allow"

A workaround we currently use is to return Permission.criticalAlerts.status; after the request to get the correct status.

### Expected results

returns PermissionStatus.permanentlyDenied

### Actual results

returns PermissionStatus.granted

### Code sample

Code sample

```dart
Future requestCriticalAlertPermission() async {
final permissionStatus = await Permission.criticalAlerts.request();
// This will return PermissionStatus.granted on the first request even if the user has denied the permission.
return permissionStatus;
}

```

### Screenshots or video

_No response_

### Version

11.2.1

### Flutter Doctor output

/Users/pfraunlob/dev/source/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel stable, 3.16.7, on macOS 14.3 23D56 darwin-x64, locale de-AT)
• Flutter version 3.16.7 on channel stable at /Users/pfraunlob/dev/source/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ef1af02aea (vor 5 Wochen), 2024-01-11 15:19:26 -0600
• Engine revision 4a585b7929
• Dart version 3.2.4
• DevTools version 2.28.5

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
• Android SDK at /Users/pfraunlob/Library/Android/sdk
• Platform android-34, build-tools 33.0.1
• ANDROID_HOME = /Users/pfraunlob/Library/Android/sdk
• Java binary at: /Users/pfraunlob/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.11005911/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15C500b
• CocoaPods version 1.14.3

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
• Android Studio at /Users/pfraunlob/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.11005911/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] Android Studio (version 2022.3)
• Android Studio at /Users/pfraunlob/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.10811636/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] Connected device (3 available)
• iPhone 15 (mobile) • DEBA783D-8EDC-41B2-A2B9-9262A9F4A5D6 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 14.3 23D56 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 121.0.6167.160

[✓] Network resources
• All expected network resources are available.

• No issues found!
Process finished with exit code 0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.