Baseflow / Baseflow/flutter-permission-handler

[Bug]: Request permission returns `permanentlyDenied` when iOS app minimized while permission dialog is open

Open
#1,423 1 comment 5 reactions 0 assignees 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 for notifications permission on iOS (when current status is `.denied` meaning that it was not asked yet)
2. Minimize the application by clicking home button/sliding up

### Expected results

The dialog should either remain open or the `PermissionStatus` should stay as `.denied`.

### Actual results

Dialog closes and `Permission.notification.request()` returns `PermissionStatus.permanentlyDenied`.
After refreshing the app the status is `PermissionStatus.denied` again

### Code sample

Code sample

```dart
class MainApp extends StatelessWidget {
const MainApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: TextButton(
onPressed: () async {
final result = await Permission.notification.request();
print(result);
},
child: const Text('Request Permission'),
),
),
),
);
}
}
```

### Screenshots or video

Screenshots or video demonstration

[Upload media here]

### Version

11.3.1

### Flutter Doctor output

Doctor output

```console
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.5, on macOS 15.0.1 24A348 darwin-arm64, locale
en-PL)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.95.3)
[✓] Connected device (5 available)
[✓] Network resources

• No issues found!

```

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.