We have followed the official instructions for disabling the auto-assigned UNUserNotificationCenterDelegate and implementing our own delegate methods exactly as described in the documentation. This worked perfectly with library v3, but after migrating to v4 the application crashes when tapping a notification when the app is in background.
I can temporarily fix the issue by ensuring that the completion handler is ran in the main thread. So for example instead of implementing the method like this (as instructed in the documentation):
The reason why we set USER_NOTIFICATION_CENTER_DELEGATE_ENABLED to False is because we need additional logic within the delegate methods, so it's absolutely must have for us to get this fixed.
Steps to reproduce
Set USER_NOTIFICATION_CENTER_DELEGATE_ENABLED to false in NotificareOptions
Implement UNUserNotificationCenterDelegate functions according to your documentation
Send a push notification when the app is in background
Is there an existing issue for this?
Describe the bug
We have followed the official instructions for disabling the auto-assigned UNUserNotificationCenterDelegate and implementing our own delegate methods exactly as described in the documentation. This worked perfectly with library v3, but after migrating to v4 the application crashes when tapping a notification when the app is in background.
I can temporarily fix the issue by ensuring that the completion handler is ran in the main thread. So for example instead of implementing the method like this (as instructed in the documentation):
I would do this:
By quickly looking into the crash and the Notificare codebase, it seems like Notificare library is calling the completion handlers of the UNUserNotificationCenterDelegate methods in a background thread which might cause this crash. I'm not 100% sure about this though. Related code: https://github.com/Notificare/notificare-sdk-ios/blob/main/NotificarePushKit/Sources/Internals/NotificarePushImpl%2BUNUserNotificationCenterDelegate.swift#L16 https://github.com/Notificare/notificare-sdk-ios/blob/main/NotificarePushKit/Sources/Internals/NotificarePushImpl%2BUNUserNotificationCenterDelegate.swift#L27
Sentry screenshot:
The reason why we set USER_NOTIFICATION_CENTER_DELEGATE_ENABLED to False is because we need additional logic within the delegate methods, so it's absolutely must have for us to get this fixed.
Steps to reproduce
Expected behaviour
App does not crash when tapping a notification.
Relevant log output
No response
Library version
4.0
Operating system
iOS 18
Smartphone model
No response
Additional context
No response