-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[v5] [iOS] Register for remote notifications fix #2726
[v5] [iOS] Register for remote notifications fix #2726
Conversation
… be run on the main thread
Further evidence that proves this should be called from the main thread: https://stackoverflow.com/questions/44391367/uiapplication-registerforremotenotifications-must-be-called-from-main-thread-o |
Very interesting issue - thanks for the PR, and the background link I investigated the CI failure I expect I simply re-triggered the build so we could see if it a transient network blip causing the timeout, or if it's a repeatable issue and warrants deeper inspection |
Ok, there is definitely a problem here:
what and why I can't speculate - as mentioned above it could be the test itself is making an incorrect assumption, it could be the code change here broke something legitimate, or it could just be that bitrot/entropy took over and the tests no longer pass on the current 5.5.6 release - but it is consistently failing right now which unfortunately makes this unreleasable as is patch-package is of course available for local needs while it is sorted out - your change in general looks reasonable so I'm surprised to see this failure |
For completeness I will say that I successfully ran the e2e tests locally a while back but it has been a long long time. If you carefully follow the README in the v5.5.x tests app for setting up the iOS side of the e2e tests it should be possible to run it for the current public release (5.5.6) to prove it can work, then integrate this change and see what happened? |
It seems like the tests are flaky. When running them locally, initially the same one failed as well. So I tried a clean run and it ran perfectly: https://gist.githubusercontent.com/mcuelenaere/597d8d1240f5c95ac7b9345642c70cf3/raw/af8b1da910afcc8a3a69be9a203e9809c088bd86/gistfile1.txt Can you trigger a rebuild on the CI environment? |
Well this is frustrating - those specific tests are a bit flaky but this is failing each time for the last 4 times I have re-run that build step just now. At the same time I read your test session (thank you!) and of course it looks fine. It needs a bit deeper inspection but the actual change does look fine |
Got runtime warning in xcode
This pr makes a lot of sense. @mikehardy Can we have it tested again and merge? |
@frankyjuang This does make sense - it's targeted enough and causing crashes I could see doing a patch release on v5, I'll put it in my queue and scour the rest of the issues/PRs to see if there's anything else worth putting in there. In the meantime (since it might take a while, sorry) please check out https://github.com/ds300/patch-package it is ace for this situation. Now that we have code that seems to work you can just patch it in, safely, instead of waiting for a maintainer here. I would also love to hear that someone else has patched it in and it's working for them since v5 testing is clearly problematic in this method |
Thanks @mikehardy really appreciated. Will try the patching. |
Hey @mcuelenaere, thank you for your pull request. We’re no longer actively supporting |
Summary
We've observed crashes on iOS 13 when calling
RNFirebaseMessaging registerForRemoteNotifications:rejecter:
in the wild.When checking the code,
registerForRemoteNotifications
is not being called from the main thread (while 5 lines above it, inrequestPermission
, it is being done so).This also corresponds with the crash stack traces we've seen, none of them are on the main thread.
Bottom line: calling this method from the main thread has no negative impact and should hopefully fix these crashes.
Checklist
Android
iOS
e2e
tests added or updated in packages/**/e2eTest Plan
Call
registerForRemoteNotifications
and notice app not crashing.Release Plan
[IOS][BUGFIX] [MESSAGING] - Register for remote notifications should run on main thread
Think
react-native-firebase
is great? Please consider supporting the project with any of the below:React Native Firebase
andInvertase
on Twitter