iOS App Crash when init Alarm.
Closed this issue · 8 comments
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:
- ...
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.
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.
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 await
ed). 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
.
I still have same issue
Hi guys,
Some recommendations:
- make sure you call
Alarm.init
just once - don't directly use
AlarmStorage
- use
await
for all alarm operations
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
@North101 You can folk the project and fix the code below. The app is not crash.
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.
I can confirm that the latest version fixes the crashes