gdelataillade / alarm

A Flutter plugin to easily manage alarms on iOS and Android
https://pub.dev/packages/alarm
MIT License
132 stars 86 forks source link

iOS App Crash when init Alarm. #209

Closed iSaqibShafique closed 1 month ago

iSaqibShafique commented 5 months ago

Alarm plugin version 3.1.4

Describe the bug When I do initialize the Alarm in main() and trying running app on Simulator, it start crashing.

To Reproduce Steps to reproduce the behavior:

  1. ...

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Device info Simulator iPhone 12 mini. iOS 17.4

Additional context Add any other context about the problem here.

gdelataillade commented 5 months ago

Hi @iSaqibShafique

Make sure you followed the installation steps in the README. Also you should use the await keyword every time you call a method from Alarm class. Please let me know if it fixes your crash.

North101 commented 5 months ago

I am also having this happen on iOS when doing a hot reload with multiple alarms set, and also in general when multiple alarms are set in succession (with each being awaited). My fix has been to add a delay of 100ms after each Alarm.set call in my app, but I obviously can't do this within Alarm.init.

BaoTrung37 commented 3 months ago

I still have same issue

gdelataillade commented 3 months ago

Hi guys,

Some recommendations:

North101 commented 3 months ago

I am doing all of those things and yet it still causes crashes on iOS. Specifically when scheduling multiple alarms in a row (each of which is awaited). I have been able to reduce the chance of crashes during runtime by putting a delay of 100ms between each scheduled alarm. However it also crashes every time I hot reload

BaoTrung37 commented 3 months ago

@North101 You can folk the project and fix the code below. The app is not crash. image

gdelataillade commented 1 month ago

I'm closing this issue because in the meantime version 4.0.0 was released including a significant refactoring of the code and many bug fixes. Feel free to reopen if needed.

North101 commented 1 month ago

I can confirm that the latest version fixes the crashes