我在OnMessageReceived处理程序上实现Xamarin.iOS应用程序上的Sendbird,并且已经收到消息。
但是我无法接收推送通知,GetPendingPushToken()总是返回null,所以在RegisterAPNSPushTokenForCurrentUser()方法中,我只传递一个带有设备令牌的字符串。并在SendBird仪表板上注册用户令牌,如下所示:
"05d0c16a 52328ef2 973b29bb91556ed6 59dcb340 321dc3e6 b0842c20 6e5190d2“。
我注意到,在registerDevicePushToken() SDK中,我无法访问iOS SDK中可用的方法.NET,在示例中,该方法是在didRegisterForRemoteNotificationsWithDeviceToken()方法中实现的。
API是在SendBird仪表板上正确设置的,我已经从另一个API接收到设备上的推送通知。
发布于 2018-09-14 02:03:12
SendBird .NET SDK提供了两种push注册方法,因为它可以同时用于安卓和iOS。
安卓: RegisterFCMPushTokenForCurrentUser
iOS: RegisterAPNSPushTokenForCurrentUser
SendBirdClient.Connect(userId, (User user, SendBirdException e) => {
if (e != null) {
// Error.
return;
}
if (SendBirdClient.GetPendingPushToken() == null) return;
// For Android
SendBirdClient.RegisterFCMPushTokenForCurrentUser(SendBirdClient.GetPendingPushToken(), (SendBirdClient.PushTokenRegistrationStatus status, SendBirdException e1) => {
if (e1 != null) {
// Error.
return;
}
if (status == SendBirdClient.PushTokenRegistrationStatus.PENDING) {
// Try registration after connection is established.
}
});
// For iOS
SendBirdClient.RegisterAPNSPushTokenForCurrentUser(SendBirdClient.GetPendingPushToken(), (SendBirdClient.PushTokenRegistrationStatus status, SendBirdException e1) => {
if (e1 != null) {
// Error.
return;
}
if (status == SendBirdClient.PushTokenRegistrationStatus.PENDING) {
// Try registration after connection is established.
}
});
});https://stackoverflow.com/questions/52285618
复制相似问题