If the onPushReceived and onPushAccepted event listeners are functioning correctly on Android but not on iOS, it is typically because the native iOS part of your application is not configured to pass notification interaction data to the Pushwoosh SDK.
To resolve this, you need to add native code to your project's AppDelegate.swift file to handle the notification response.
- In your Xcode project, open the
ios/Runner/AppDelegate.swiftfile. - Add the following method to your
AppDelegateclass. If this method already exists, simply add the linePushwoosh.sharedInstance().handlePushReceived(userInfo)inside it.
override func userNotificationCenter(
_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void
) {
let userInfo = response.notification.request.content.userInfo
// Pass the notification payload to the Pushwoosh SDK
Pushwoosh.sharedInstance().handlePushReceived(userInfo)
completionHandler()
}
This implementation ensures that when a user taps on a notification, the event is captured and passed to the Pushwoosh SDK, which will then trigger the appropriate listeners (onPushAccepted or onPushReceived) in your Flutter application.
Comments
0 comments
Please sign in to leave a comment.