I am trying to receive push notifications when a user writes a message in a channel. I have managed to register the user for these kind of notifications with the registerDevicePushToken function:
SBDMain.connect(withUserId: preferences.getUserEmail()!, completionHandler:
{ (user, error) in
if (error == nil) {
Messaging.messaging().apnsToken = deviceToken
SBDMain.registerDevicePushToken(deviceToken, unique: false, completionHandler: { (status, error) in
if error == nil {
if status == SBDPushTokenRegistrationStatus.pending {
SBDMain.connect(withUserId: preferences.getUserEmail()!, completionHandler: { (user, error) in
if error == nil {
SBDMain.registerDevicePushToken(SBDMain.getPendingPushToken()!, unique: true, completionHandler: { (status, error) in
})
}
})
}
else {
print("Success")
SBDMain.setPushTriggerOption(.all)
}
}
else {
print("Error")
print(error)
return
}
})
}
})
Nevertheless, after doing this, I can’t manage to receive the said notifications even when the app is running in the background. The user does receive the messages of the channel while in chat. I do receive other kind of push notifications, but when the Sendbird notification should be received, I don’t get any response from the app (neither in the userNotificationCenter
functions nor in the application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void)
).
Used Versions:
- Xcode 13.0
- OS 13.5
- SendBirdSDK (3.1.13)