0

我在接收来自 2 个不同服务器的推送通知时遇到了一些问题。服务器的后端代码是用 Java 编写的,我使用javapns了用于苹果推送通知的库。当我收到通知(来自其中一台服务器)时,我收到以下日志语句,

2015-11-06/12:17:15.829 [DEBUG] [] [javapns.notification.Payload] - 添加警报 [警报消息]

2015-11-06/12:17:16.054 [调试] [] [javapns.communication.ConnectionToAppleServer] -Creating SSLSocketFactory

2015-11-06/12:17:16.127 [调试] [] [javapns.communication.ConnectionToAppleServer] -Creating SSLSocket to gateway.sandbox.push.apple.com:2195

2015-11-06/12:17:16.776 [调试] [] [javapns.notification.PushNotificationManager] -Initialized Connection to Host: [gateway.sandbox.push.apple.com] Port: [2195]: 6644621c[SSL_NULL_WITH_NULL_NULL: Socket[addr=gateway.sandbox.push.apple.com/17.172.232.45,port=2195,localport=57181]]

2015-11-06/12:17:16.778 [调试] [] [javapns.notification.PushNotificationManager] -Building Raw message from deviceToken and payload

2015-11-06/12:17:16.779 [调试] [] [javapns.notification.PushNotificationManager] -Built raw message ID 1 of total length 91

2015-11-06/12:17:16.779 [调试] [] [javapns.notification.PushNotificationManager] -Attempting to send notification: {"aps":{"alert":"Alert Message"}}

2015-11-06/12:17:16.779 [调试] [] [javapns.notification.PushNotificationManager] - to device: e61aa2adfa16449f894b317ea3b4dbbfe4589000abdec7c8c0eb3c7b92654e4c

2015-11-06/12:17:17.696 [调试] [] [javapns.notification.PushNotificationManager] -Flushing

2015-11-06/12:17:17.696 [调试] [] [javapns.notification.PushNotificationManager] -At this point, the entire 91-bytes message has been streamed out successfully through the SSL connection

2015-11-06/12:17:17.696 [调试] [] [javapns.notification.PushNotificationManager] -Notification sent on first attempt

2015-11-06/12:17:17.696 [DEBUG] [] [javapns.notification.PushNotificationManager] - 阅读回复

2015-11-06/12:17:22.698 [DEBUG] [] [javapns.notification.PushNotificationManager] - 关闭连接

但是,当我没有收到通知(来自另一台服务器)时,我得到以下日志,

2015-11-20/13:37:50.539 [DEBUG] [] [javapns.notification.Payload] - 添加警报 [警报消息]

2015-11-20/13:37:50.543 [DEBUG] [] [javapns.notification.PushNotificationManager] - 阅读回复

2015-11-20/13:37:50.545 [DEBUG] [] [javapns.notification.PushNotificationManager] - 关闭连接

在这里,我没有收到任何有关创建 SSL 套接字工厂或其他突出显示的文本的日志语句。并且ConnectionToAppleServer课程没有被调用。所以,我怀疑我是否缺少任何 jar 文件。

注意:我在两台服务器中都使用相同的开发证书。

任何帮助将不胜感激。

4

1 回答 1

0

问题不在于开发人员证书或与 iOS 相关的任何 jar 文件。编写服务器代码是为了向 android 和 iOS 发送通知。并且一些与android相关的jar文件丢失了。因此,在后端,控制力到达了编写发送 iOS 通知的代码的部分。这就是问题所在。一旦添加了这些 jar 文件,一切正常!!

于 2016-02-05T13:24:56.770 回答