invertase / react-native-notifee

Moved to https://github.com/invertase/notifee
https://invertase.io/blog/open-sourcing-notifee
Other
466 stars 31 forks source link

[IOS] Looks like Notification Service Extension does not process my notifications anymore #287

Closed antoinefBam closed 3 years ago

antoinefBam commented 3 years ago

Hi,

Just after it was released I've implemented the Notification Service Extension for IOS in my project. At this time all was working well.

I was able to send notification payload like this trough FCM:

    {
        "to": "TOKEN",
        "notification": {
          "title": "some title",
          "body": "some body"
        },
        "apns": {
            "payload": {
                "aps": {
                    "content-available": 1,
                    "mutable-content": 1
                },
                "notifee_options": {
                    "image": "some url",
                    "data": {
                        "some": "data",
                    },
                    "ios": {
                        "categoryId": "some_category",
                    }
                }
            }
        }
    }

Then notification was received and displayed properly. Then background message handler received the right event when notification was clicked etc.

After some time in production we noticed it stopped working. Notification are still displayed but only handled by FCM (basic body/title notification, image does not appear anymore). No event is detected in background handler when notification is opened. In fact only in-app notifications are still processed by Notifee in the IOS app. Other notifications seem to be detected by FCM only.

I've noticed some open issues about difficulties to fire event when notification is clicked but in my case it goes even further in the sense that the notifications never reach the service.

I can't figure out what may have changed. It is even weirder since building my app at the first commit Notification Service Extension was implemented in my app (and worked at the time) does not resolve the issue.

Here are the versions used for the involved libraries:

 "react-native": "0.62.2",
 "@notifee/react-native": "1.2.1",
 "@react-native-firebase/app": "11.1.0",
 "@react-native-firebase/messaging": "11.1.0",
 "@react-native-firebase/perf": "11.1.0",

Do you have any idea/clue about what may have happened ? Or any information to take my debugging process further ?

Thanks in advance !

helenaford commented 3 years ago

Hi there, this is strange. when you say "I can't figure out what may have changed. It is even weirder since building my app at the first commit Notification Service Extension was implemented in my app (and worked at the time) does not resolve the issue.", does this mean you see the problem locally too? or just in production?

antoinefBam commented 3 years ago

Hi there, this is strange. when you say "I can't figure out what may have changed. It is even weirder since building my app at the first commit Notification Service Extension was implemented in my app (and worked at the time) does not resolve the issue.", does this mean you see the problem locally too? or just in production?

Both locally and in production

helenaford commented 3 years ago

if you see this locally, i'd say it's to do with your setup. Has anything changed with your iOS configuration? Have you tried to go back to the stage where it was working in your project (revert any commits to the last place you saw it working)?

antoinefBam commented 3 years ago

What I am trying right now is to remove then setup again notifee + extension service on IOS. I will keep you informed 👍

helenaford commented 3 years ago

To do a quick debug, leave it the service extension code as

self.bestAttemptContent.title = [NSString stringWithFormat:@"%@ [modified]", self.bestAttemptContent.title];

self.contentHandler(self.bestAttemptContent);

if title isn't changing, you know 100% that your extension isn't being triggered.

antoinefBam commented 3 years ago

To do a quick debug, leave it the service extension code as

self.bestAttemptContent.title = [NSString stringWithFormat:@"%@ [modified]", self.bestAttemptContent.title];

self.contentHandler(self.bestAttemptContent);

if title isn't changing, you know 100% that your extension isn't being triggered.

Thank you for this hint I will give it a try !

antoinefBam commented 3 years ago

@helenaford Thanks for your help. After doing some cleanup and adding the [modified] tag in the extension service it appears that this one is doing his job properly 🙃

It made me realize that I actually had 2 independent concerns.

Concerning this issue I guess we can close it as it does not seem to concern the Notification Service Extension in the end.

helenaford commented 3 years ago

hey, good news about the extension. to make it clearer and easier to help with your concerns, could you make the second concern into its own issue, and create one for the first concern once you've finished investigating. and, i'll close this one.