Pushwoosh / pushwoosh-react-native-plugin

Other
57 stars 43 forks source link

[Bug]: open iOS notification while app is closed not passing the notification's payload to the app #162

Closed avivdim closed 4 months ago

avivdim commented 5 months ago

Documentation

Description

When I click on the iOS notification, it opens my app but the 'pushOpened' listener is not triggered. I added the NotificationService via Xcode and added some code to receive notifications with attachments: Screenshot 2024-03-28 at 11 41 57

It is also hard to test it as I'm not getting any push notification while in debug mode, so I need to release a new build every time and test it over and over again. If there is another solution for that, it would be nice. Another issue is with this NotificationService.m when I'm trying to add the new code from your documentation, it says that 'PWNotificationExtensionManager.h' file is not found... I'm currently using version 6.1.14 but also tested it with 6.1.30 and the issue still persists. I'm using React Native version 0.68.2.

Bug severity

High

Steps to Reproduce

Send a push to the app, click on it while the app is closed. The app is open but 'PushOpened' is not triggered, and I need to use notification payload to know where I should lead the user to. issue is only on ios.

Your Pushwoosh React Native Plugin version

6.1.14

Last worked Pushwoosh React Native Plugin version (if any)

No response

Affected platforms

Affected OS versions and/or devices

tested on 16 and 17 ios

Workaround

No response

Relevant log output

No response

enginseer-dev commented 5 months ago

Hi @avivdim! The issue you're reporting was fixed with the 6.1.30 release. Could you please test this version again? Please make sure that all dependencies are updated. If the problem persists, please contact our support at help@pushwoosh.com for further investigation.

You're not receiving notifications in the Debug mode most likely because your Pushwoosh application is configured with the Production certificate. We recommend using separate apps for development and production.

Another issue is with this NotificationService.m when I'm trying to add the new code from your documentation, it says that 'PWNotificationExtensionManager.h' file is not found...

Do I understand correctly that you're adding badges for your app using the code from this guide Setting up Badges for React Native?

avivdim commented 5 months ago

Hi @enginseer-dev. Thanks for the detailed comment. I upgraded to version 6.1.30 again and it seems like the issue was that the iOS SDK wasn't updated and stayed on an old version. After updating the pod, it was working and the issue was solved as you said! Regarding the issue of not receiving push notifications in debug mode, I will try to check it again and will update if it is solved.

Do I understand correctly that you're adding badges for your app using the code from this guide Setting up Badges for React Native?

Screenshot 2024-03-30 at 15 20 20

Actually, no. I was trying to use this link: https://docs.pushwoosh.com/platform-docs/pushwoosh-sdk/ios-push-notifications/ios-message-delivery-tracking. I tried to follow the same steps and got the error "PWNotificationExtensionManager.h' file not found." I will also check the badges guide, as it could be helpful for my app. However, it would be good to know why I am getting this error and need to revert to the old approach as shown in the bug image.

Thanks !

enginseer-dev commented 5 months ago

Hi @avivdim! It's great that the initial issue is resolved!

Regarding the Message Delivery Tracking, could you please try importing the class with #import <Pushwoosh/PWNotificationExtensionManager.h>? It should fix the error.

avivdim commented 5 months ago

Hi @enginseer-dev

I don't receive any notifications on dev mode when running the real device while connecting to Xcode, even when I'm trying to take hwid/token from a Pushwoosh sdk and sending notification via createMessage api its saying unknown device.any idea?

Regarding the second issue with message delivery tracking, the issue still showed even when I tried to import the class as you wrote.

enginseer-dev commented 5 months ago

@avivdim, since React Native does not automatically link all required dependencies to a target that was created manually, please make sure that the libs/frameworks are added to your project the way it's described in the Setting up Badges for React Native article (4. Link dependencies to a target).

To troubleshoot the "unknown device" issue, could you please contact our support at help@pushwoosh.com? We will need to review your account and probably the device logs to determine the reason for the issue.