-
Notifications
You must be signed in to change notification settings - Fork 286
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 18 calling the push handler twice when the app is in foreground #295
Comments
This issue occurs with iOS 18+ and is not related to the plugin. I have already created a minimal reproduction repository of a native iOS application, demonstrating that this issue exists outside of Cordova and the plugin I submitted a report to Apple prior to the release of iOS 18 but have not yet received a response. |
Nice, thanks! Good to see you around <3 |
@igorsantos07 I pushed a PR that could be the solution. I see two possible approaches to resolve this issue: 1. Native/Plugin (PR Solution)In this PR, I've added logic specifically for iOS 18.0 to check if the notification payload is a duplicate. The duplication check is based on two key pieces of information:
If both the timestamp and content are identical, the second payload is discarded, preventing duplicate processing. 2. App Developer (Alternative Solution)An alternative solution would require app developers to handle the duplicate detection on the front-end. For example, developers could:
Currently, the payload's date/timestamp is not passed to the front-end, so developers would need to manage this comparison themselves. Let me know your thoughts:
Just to reiterate, this fix only applies to iOS 18.0. I’ve tested it with the official release of iOS 18.1, and the issue seems resolved. However, I couldn’t find any comments in the Release Notes, and they haven't responded to my bug ticket yet. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug Report
Expected Behaviour
On iOS 17 (and previous versions), our app was working correctly, and receiving a single call to the push handler.
Actual Behaviour
Once I updated my device to iOS 18, it started calling the handler twice. This does not happen on background, and wasn't reproduced on other two devices with iOS 17, nor our logs show it's suddenly sending two pushes.
Reproduce Scenario (including but not limited to)
Steps to Reproduce
Not adding the rest given no one is probably going to fix it, but I wanted to report it anyway so users are a tiny bit aware of the problem, and possible workarounds.
My best bet so far is trying ideas with Lodash functions: lodash/lodash#2403
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
(Android) Device Vendor (e.g. Samsung, HTC, Sony...)
Androids are not affected
iOS
Version 18.0.1
cordova info
PrintoutIgnored as well
Sample Push Data Payload
Ignored as well
Sample Code that illustrates the problem
Ignored as well
Logs taken while reproducing problem
Ignored as well
The text was updated successfully, but these errors were encountered: