全部,
我正在尝试让 Apple 推送通知在 Mac 上运行。但是我遇到了以下问题,需要一些帮助来弄清楚发生了什么。
我已经实现了 Worklight 的入门页面中的推送通知示例。我能够在我的 iPhone 4S 上安装该应用程序并能够订阅推送通知。我可以在我的 Worklight Console 中看到一个用户和订阅。当我执行适配器程序将通知推送到我的设备时,我看到消息说消息已发送给用户:XXX。但是,然后我看到以下错误消息:
[WARNING ] Failed to send message com.notnoop.apns.EnhancedApnsNotification@30f6ea2a... trying again
[WARNING ] Failed to retreive invalid devices
[WARNING ] Failed to retreive invalid devices
[WARNING ] Failed to retreive invalid devices
[ERROR ] Couldn't get feedback connection
[ERROR ] Unknown exception: java.net.UnknownHostException: feedback.sandbox.push.apple.com
[WARNING ] Failed to retreive invalid devices
[WARNING ] Failed to retreive invalid devices
[WARNING ] Failed to retreive invalid devices
[ERROR ] Couldn't get feedback connection
[ERROR ] Unknown exception: java.net.UnknownHostException: feedback.sandbox.push.apple.com
在谷歌搜索以找出上述问题的解决方案时,建议可能存在一些网络问题。我关闭了防火墙,并且能够 ping 通 APNS 服务器。
$ telnet 1-courier.push.apple.com 5223
Trying 17.149.32.15...
Connected to 1.courier-push-apple.com.akadns.net.
Escape character is '^]'.
$ telnet gateway.sandbox.push.apple.com 2195
Trying 17.149.34.65...
Connected to gateway.sandbox.push-apple.com.akadns.net.
Escape character is '^]'.
$ telnet gateway.push.apple.com 2195
Trying 17.172.233.147...
Connected to gateway.push-apple.com.akadns.net.
Escape character is '^]'.
我还尝试允许 APNS 使用以下端口,但没有运气。
$ sudo ipfw add 0 allow tcp from any to any 2195
00100 allow ip from any to any proto tcp dst-port 2195
$ sudo ipfw add 0 allow tcp from any to any 5223
00200 allow tcp from any to any dst-port 5223
$ sudo ipfw add 0 allow tcp from any to any 2196
00300 allow tcp from any to any dst-port 2196
$ sudo ipfw add 0 allow tcp from any to any 443
00400 allow tcp from any to any dst-port 443
Worklight 版本(Studio):V6.0 MacPro 配置:防火墙已关闭 Wi-fi 路由器:防火墙已关闭 iPhone 4S:在设置中启用通知