I have integrated UNNotificationServiceExtension which allows me to change the push notification title before it's presented to the user.
I have followed the guidelines mentioned in apple developer documentation and also browsed related questions at SO, But nothing seems to be working.
As directed, i have followed these guidelines
- Include "mutable-content": 1 in your push notification payload
- Extension's deployment target should be set correctly (should match with main app target)
- The payload must include an alert dictionary with title, subtitle, or body information
- The 'aps' dictionary in payload of the push notification must include a key 'category' with a string value.
The problem
My notification service extension is not triggered sometimes when push notification is received, mostly when i delete and install a fresh copy of app. Breakpoints also don't get triggered in this case. It looks like system forgets to fire the service extension. I have selected the correct scheme of extension and not the main app target. My notification title is not updated as per my logic.
Note: This is occurring on iOS 14. on iOS 12, it is working fine. Is this an iOS bug?
This is already being discussed in these threads.
https://developer.apple.com/forums/thread/67202 https://developer.apple.com/forums/thread/125987
Any help would be much appreciated. Thanks
Sample Code
I made a sample project to demonstrate this issue. You can download it from Github Repo
