-
Notifications
You must be signed in to change notification settings - Fork 16
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
fix: expo users reported app crash on didFailToRegisterForRemoteNotificationsWithError #575
Conversation
Sample app builds 📱Below you will find the list of the latest versions of the sample apps. It's recommended to always download the latest builds of the sample apps to accurately test the pull request.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #575 +/- ##
==========================================
+ Coverage 56.25% 56.79% +0.53%
==========================================
Files 132 132
Lines 3715 3717 +2
==========================================
+ Hits 2090 2111 +21
+ Misses 1625 1606 -19 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you write tests for this change?
It would be great if we had a test that could reproduce the crash and then show that after this change the test passes.
@levibostian I started writing test cases for this swizzled method but it looks like a larger effort and updates than I anticipated. As this fix is a result of a crash report by a customer, would would mind if I open a tech debt and let go this fix ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I checked the CI status checks that are failing in this PR and they are also failing in main
. Therefore, it's OK with me to merge this PR with the current failed status checks and fix the main
branch in a separate PR.
## [2.12.3](2.12.2...2.12.3) (2024-03-05) ### Bug Fixes * expo users reported app crash on didFailToRegisterForRemoteNotificationsWithError ([#575](#575)) ([ac70292](ac70292))
part of: https://linear.app/customerio/issue/MBL-141/expo-50-with-version-100-beta15-crash-startup-app-on-ios
Steps to reproduce the bug
There are no direct steps reported by the customer to reproduce the issue.
Other known ways to reproduce
didFailToRegisterForRemoteNotificationsWithError
:OR
How this PR fixes the bug
Let's understand what the bug is first. The issue is with the instance of
messagingPush
that is not initialised by the time it is called and hence the app crashes. This PR fixes it by usingSelf.shared
instead ofmessagingPush
and callsdeleteDeviceToken
method that further callsmessagingPush.deleteDeviceToken()
that has a living instance ofmessagingPush
and hence the code is executed without any issue.What you have done to test this PR
Since there are no steps reported by the customer, I reproduced the issue by calling messagingPush.deleteDeviceToken() in
didRegisterForRemoteNotificationsWithDeviceToken
instead of into methoddidFailToRegisterForRemoteNotificationsWithError
. This helped me figure out where the issue lies.Complete each step to get your pull request merged in. Learn more about the workflow this project uses.