【问题标题】:Javapns push notification Invalid TokenJavapns 推送通知无效令牌
【发布时间】:2018-01-25 09:34:21
【问题描述】:

我正在尝试推送通知,但每次收到无效令牌时。 我得到的错误是:

APNS: [1] Invalid token javapns.notification.exceptions.ErrorResponsePacketReceivedException: 收到来自 APNS 服务器的错误响应包:APNS: [1] Invalid token]

PushNotificationPayload payload=PushNotificationPayload.complex();
payload.addAlert("Hello");

PushedNotifications Notify=Push.alert("hiii", "C:\\Users\\Documents\\PushNotification\\APNS.p12", "123456", true, "Device Token ");/*ra*/
PushedNotification.findSuccessfulNotifications(Notify);

NotificationTest.printPushedNotifications(Notify);

System.out.println("Success "+PushedNotification.findSuccessfulNotifications(Notify));
System.out.println("failed "+PushedNotification.findFailedNotifications(Notify));

【问题讨论】:

    标签: java ios push-notification


    【解决方案1】:

    APNS:[1] 无效令牌表示您使用的设备令牌无效。假设您的应用程序从 Apple 获得了此设备令牌(并且您没有使用随机令牌),您可能正在使用开发令牌向生产推送服务器发送推送通知,反之亦然。设备令牌仅在一种环境(沙盒或生产环境)中有效。

    【讨论】:

    • 我检查了生产和沙箱的设备令牌,它显示相同的错误。我们正在使用第三方推送通知,我通过 IOS 收到通知,但是当我使用 java(以上代码)时,我收到 Device token error。如果它在 IOS 中工作,我假设设备令牌是正确的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-08-08
    • 1970-01-01
    • 1970-01-01
    • 2012-04-06
    • 1970-01-01
    • 2020-11-14
    • 1970-01-01
    相关资源
    最近更新 更多