Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS App Crash when init Alarm. #209

Open
iSaqibShafique opened this issue Jun 4, 2024 · 6 comments
Open

iOS App Crash when init Alarm. #209

iSaqibShafique opened this issue Jun 4, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@iSaqibShafique
Copy link

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.

@iSaqibShafique iSaqibShafique added the bug Something isn't working label Jun 4, 2024
@gdelataillade
Copy link
Owner

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.

@gdelataillade gdelataillade added the needs author feedback Further information or answer is requested by author label Jun 5, 2024
@North101
Copy link

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
Copy link

I still have same issue

@gdelataillade
Copy link
Owner

Hi guys,

Some recommendations:

  • make sure you call Alarm.init just once
  • don't directly use AlarmStorage
  • use await for all alarm operations

@gdelataillade gdelataillade removed the needs author feedback Further information or answer is requested by author label Aug 2, 2024
@North101
Copy link

North101 commented Aug 4, 2024

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants