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

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

Open piotruela opened this issue 10 months ago • 1 comments

Please check the following before submitting a new issue.

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
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
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!

piotruela avatar Dec 23 '24 11:12 piotruela