You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Bug]: UNNotificationServiceExtension didReceiveNotificationExtensionRequest tries to handle UNNotificationRequest that was sent not by OneSignal
#1117
The problem is with handling push notifications that contain images.
We have UNNotificationServiceExtension implemented and the problem occurs because we have two different push-sending services (Optimove and OneSignal). Both support images, both have their own attachment handler and we have a race condition between them when we receive a push from Optimove.
Both handlers call contentHandler closure and if OneSignal does it faster then the image is skipped due to a different payload structure. Both of the services don’t have any public API that helps the developer to figure out that the push was sent by this specific service and not another so we cannot figure out which handler should be called. Calling Optimove's handler doesn't harm any other service because they try to handle notification requests and call contentHandler closure only if the payload has a specific structure (some list of fields should exist). On the other hand, calling
is not safe if you are not sure that notification was sent by OneSignal because OneSignal calls contentHandler closure anyway so if it will be first then push attachment will be skipped at all.
Steps to reproduce?
1. Integrate OneSignal SDK
2. Send a push with an image not from OneSignal dashboard
AR: Image content is skipped
ER: Image is presented in the notification
What did you expect to happen?
I'm expecting to have the ability to figure out was UNNotificationRequest come from OneSignal to avoid calling handler or update the logic of
to not call contentHandler closure if OneSignal doesn't know how to handle the attachment of received UNNotificationRequest. Not calling contentHandler at all gives that notification is presented anyway but without an image so removing calling contentHandler closure is safe if the notification was sent by any other service.
OneSignal iOS SDK version
3.9.1
iOS version
15, 14, 13, 12, 11 or below
Specific iOS version
No response
Relevant log output
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
@alpono Thank you for reaching out. I will look into making sure there are no side effects for OneSignal notifications, but in the mean time you can distinguish if it is a OneSignal notification by reading the request.content.userInfo and seeing if it has the os_data field.
What happened?
The problem is with handling push notifications that contain images.
We have
UNNotificationServiceExtension
implemented and the problem occurs because we have two different push-sending services (Optimove and OneSignal). Both support images, both have their own attachment handler and we have a race condition between them when we receive a push from Optimove.Both handlers call
contentHandler
closure and if OneSignal does it faster then the image is skipped due to a different payload structure. Both of the services don’t have any public API that helps the developer to figure out that the push was sent by this specific service and not another so we cannot figure out which handler should be called. Calling Optimove's handler doesn't harm any other service because they try to handle notification requests and call contentHandler closure only if the payload has a specific structure (some list of fields should exist). On the other hand, callingis not safe if you are not sure that notification was sent by OneSignal because OneSignal calls
contentHandler
closure anyway so if it will be first then push attachment will be skipped at all.Steps to reproduce?
What did you expect to happen?
I'm expecting to have the ability to figure out was UNNotificationRequest come from OneSignal to avoid calling handler or update the logic of
to not call
contentHandler
closure if OneSignal doesn't know how to handle the attachment of receivedUNNotificationRequest
. Not callingcontentHandler
at all gives that notification is presented anyway but without an image so removing callingcontentHandler
closure is safe if the notification was sent by any other service.OneSignal iOS SDK version
3.9.1
iOS version
15, 14, 13, 12, 11 or below
Specific iOS version
No response
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: