Closed vincentneo closed 1 year ago
The error is returned when APNS recently rejected provided token as invalid. When it is received, the app needs to ask OS for a new push notification token.
@levlam but with every app launch I call WKApplication.shared().registerForRemoteNotifications()
which in turn calls the delegate function didRegisterForRemoteNotifications(withDeviceToken deviceToken: Data)
.
That function provides a (presumably new device token) after which I call TDLib's registerDevice
with that token.
The issue happens even after a fresh relaunch, so are there any other possibilities where APNS will reject the token?
By the way, didFailToRegisterForRemoteNotificationsWithError https://developer.apple.com/documentation/watchkit/wkextensiondelegate/3141923-didfailtoregisterforremotenotifi
was never called either.
registerForRemoteNotifications
each time returns the same already invalid token and the token must be refreshed by calling unregisterForRemoteNotifications
, waiting a second, and then calling registerForRemoteNotifications
. The server knows that the provided token is invalid, because APNS has returned an error when the server tried to use the token.
thanks for the advice, will try it out.
Yup that seems to have solved it!
Once again thank you very much @levlam!
I've realise that
registerDevice
recently is returning me an error, with code 400, and the message isTOKEN_WAS_INVALIDATED
.Device with observed issue is Apple Watch, watchOS 9.3.1.
device_token
type isdeviceTokenApplePush
.other_user_ids
is sent with an empty array.Notifications are not being received.
What does that mean, and what can I do to remedy that?