Pushwoosh and Firebase handle notifications differently when an app is open. If foreground alerts work for Firebase but not Pushwoosh, the cause is usually how your code manages the notification delegate.
On iOS, Pushwoosh does not take over the notification delegate through method swizzling. It installs its own proxy as the UNUserNotificationCenter delegate and forwards callbacks to the delegates registered with it. If Firebase (or your own code) assigns itself as the sole UNUserNotificationCenter delegate, it can intercept the callbacks before Pushwoosh's proxy runs, so Pushwoosh never sees the incoming data or triggers its own display logic.
To fix this, register your delegate with Pushwoosh instead of setting it directly on UNUserNotificationCenter:
Pushwoosh.configure.addNotificationCenterDelegate(myDelegate)For Objective-C:
[Pushwoosh.configure addNotificationCenterDelegate:myDelegate];On Pushwoosh iOS SDK versions older than 7.3.0 the equivalent call is Pushwoosh.sharedInstance().notificationCenterDelegateProxy?.add(myDelegate); it is deprecated in newer versions.
Inside your delegate's callbacks, skip messages Pushwoosh already owns and only handle your own (for example, Firebase's):
if !PWMessage.isPushwooshMessage(notification.request.content.userInfo) {
// handle your own notification here
}If Firebase's own automatic delegate swizzling (FirebaseAppDelegateProxyEnabled) is enabled, make sure it is not also grabbing the delegate before Pushwoosh's proxy is registered.
See Custom UNNotificationCenterDelegate in the iOS SDK documentation.
Comments
0 comments
Please sign in to leave a comment.