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

iOS: Permission prompt disapears on screen lock and await never completes.

Open Cee-Ng opened this issue 1 year ago • 3 comments

🐛 Bug Report

Hi there, I'm not 100% sure if this is a bug, or an iOS behavior that can be handled in a way I'm unaware of. But hoping raising this here will lead to answers.

In the code I use the following to prompt a permission location. await Permission.locationWhenInUse.request();

under normal expected circumstances this works as expected. However on iOS if I lock the screen while the permission prompt is up, the permission prompt disappears and it appears that the await keeps waiting for a response. As in this particular case I have this as a series of set up actions waiting on each other. And so I get stuck unable to move on as this happens as that particular screen doesn't have any navigation as it auto navigates once completed.

However if I move it to a different screen and do the same trigger, it still disappears, but I am at least not stuck. I know I can theoretically try to re-trigger it on resume, or trigger it through a button press, but because of this stuck behavior that appears with the current set up, I am concerned about how the fact the await never resolved might effect the app's memory and cause issues if it were to happen several times. (someone locking and unlocking it over and over again for example)

Has anyone seen this before? I can't quite pin point if this is a bug with the package, or an issue with my set up.

Expected behavior

The Permission prompt does not dismiss on screen lock. Or if this is expected by iOS, re-prompts the permission prompt.

Reproduction steps

Trigger a permission prompt on iOS Lock the screen Unlock the screen

Configuration

Version: 10.2.0

Platform:

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

Cee-Ng avatar Apr 25 '23 19:04 Cee-Ng

Dear @Cee-Ng,

Thanks for filing this issue. I can reproduce something similar in the example app. I think we should look into it more closely. I'm not sure is we can do anything about it in the package but I'll label this as a bug for now.

TimHoogstrate avatar Aug 23 '23 07:08 TimHoogstrate

Without additional information, we are unfortunately not able to resolve this issue. Therefore, we reluctantly closed this issue for now. If you run into this issue later, feel free to file a new issue with a reference to this issue. Add a description of detailed steps to reproduce, expected and current behaviour, logs and the output of 'flutter doctor -v'. Thanks for your contribution.

github-actions[bot] avatar Sep 06 '23 07:09 github-actions[bot]

Hello @TimHoogstrate, I just came across the same issue in my app. Thanks for classifying this as a bug. Can you also reopen the github issue?

flodaniel avatar Nov 07 '23 09:11 flodaniel