0

最近开始收到此错误:

2017-11-16 16:14:00,626 [MonitoringThread-21] DEBUG com.notnoop.apns.internal.ApnsConnectionImpl - sendMessage Message(Id=1; Token=********; Payload={****Json Format *****) fromBuffer: true
2017-11-16 16:14:00,716 [MonitoringThread-21] DEBUG com.notnoop.apns.internal.ApnsConnectionImpl - Connected new socket 617c3fce[SSL_NULL_WITH_NULL_NULL: Socket[addr=gateway.push.apple.com/17.188.166.141,port=2195,localport=48067]]
2017-11-16 16:14:00,716 [MonitoringThread-21] DEBUG com.notnoop.apns.internal.ApnsConnectionImpl - Launching Monitoring Thread for socket 617c3fce[SSL_NULL_WITH_NULL_NULL: Socket[addr=gateway.push.apple.com/17.188.166.141,port=2195,localport=48067]]
2017-11-16 16:14:00,716 [MonitoringThread-21] DEBUG com.notnoop.apns.internal.ApnsConnectionImpl - Made a new connection to APNS
2017-11-16 16:14:00,716 [MonitoringThread-22] DEBUG com.notnoop.apns.internal.ApnsConnectionImpl - Started monitoring thread
2017-11-16 16:14:01,079 [MonitoringThread-22] DEBUG com.notnoop.apns.internal.ApnsConnectionImpl - Error-response packet 08080000007C
2017-11-16 16:14:01,079 [MonitoringThread-22] DEBUG com.notnoop.apns.internal.Utilities - close 617c3fce[SSL_RSA_WITH_3DES_EDE_CBC_SHA: Socket[addr=gateway.push.apple.com/17.188.166.141,port=2195,localport=48067]]
2017-11-16 16:14:01,079 [MonitoringThread-22] DEBUG com.notnoop.apns.internal.ApnsConnectionImpl - Closed connection cause=INVALID_TOKEN; id=1
2017-11-16 16:14:01,079 [MonitoringThread-22] DEBUG com.notnoop.apns.internal.ApnsConnectionImpl - Candidate for removal, message id 1
2017-11-16 16:14:01,079 [MonitoringThread-22] DEBUG com.notnoop.apns.internal.ApnsConnectionImpl - Bad message found 1
2017-11-16 16:14:01,079 [MonitoringThread-22] DEBUG com.notnoop.apns.internal.ApnsConnectionImpl - delegate.messageSendFailed, message id 1
2017-11-16 16:14:01,079 [MonitoringThread-22] DEBUG com.notnoop.apns.internal.ApnsConnectionImpl - resending 0 notifications
2017-11-16 16:14:01,079 [MonitoringThread-22] DEBUG com.notnoop.apns.internal.ApnsConnectionImpl - Monitoring input stream closed by EOF
2017-11-16 16:14:01,079 [MonitoringThread-22] DEBUG com.notnoop.apns.internal.Utilities - close 617c3fce[SSL_RSA_WITH_3DES_EDE_CBC_SHA: Socket[addr=gateway.push.apple.com/17.188.166.141,port=2195,localport=48067]]
2017-11-16 16:14:01,079 [MonitoringThread-22] DEBUG com.notnoop.apns.internal.ApnsConnectionImpl - draining buffer

一些背景:

以下是我的代码发送 APNS 通知的方式:

 String payload = null;
    try {
        ApnsService service = getService(tocCode);

        if (service != null) {

            payload = APNS.newPayload()
                    .sound("default")
                    .alertTitle(dataMap.get("title"))
                    .customFields(dataMap)
                    .alertBody(dataMap.get("message"))
                    .build();

            final Collection<? extends ApnsNotification> push = service.push(deviceids, payload);

            deleteInactiveDevices(service);

        } else {
            logger.error("Could not initialize APNS service );
        }

有时推送通知正在通过并且正在接收,而其他时候则没有,并且引发了上述错误。有人可以帮忙吗?

4

1 回答 1

0

Was having the same problem but used .withSandboxDestination() when initializing service and seems to work (even when using production certificate)

于 2017-11-21T12:44:22.507 回答