2

在使用 Twisted 和 pyapns 之前,我能够发送推送通知。我不得不重新启动我的 EC2 实例,并启动了我的 Web 服务器,然后我开始扭曲。重启后,我一直无法发送和接收推送通知,我检查了扭曲的日志,这是我发现的:

2013-02-22 17:50:40+0000 [-] Starting factory <pyapns.server.APNSClientFactory instance at 0x90f9e4c>
2013-02-22 17:50:40+0000 [-] APNSClientFactory startedConnecting
2013-02-22 17:50:40+0000 [Uninitialized] APNSProtocol connectionMade
2013-02-22 17:50:41+0000 [APNSProtocol (TLSMemoryBIOProtocol),client] APNSProtocol connectionLost
2013-02-22 17:50:41+0000 [APNSProtocol (TLSMemoryBIOProtocol),client] APNSClientFactory clientConnectionLost reason=[Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionDone'>: Connection was closed cleanly.]
2013-02-22 17:50:41+0000 [APNSProtocol (TLSMemoryBIOProtocol),client] <twisted.internet.tcp.Connector instance at 0x9025e4c> will retry in 2 seconds
2013-02-22 17:50:41+0000 [APNSProtocol (TLSMemoryBIOProtocol),client] Stopping factory <pyapns.server.APNSClientFactory instance at 0x90f9e4c>

在日志中,trackback 是: Traceback(没有帧的失败):

<class'twisted.internet.error.ConnectionDone'>: Connection was closed cleanly.]

我该如何解决这个问题?

4

1 回答 1

2

所以我实际上弄清楚了问题所在。事实证明,我的应用程序仍在向 Apple 的沙盒服务器发送通知。Apple 将拒绝在一定限制后发送任何通知。我所要做的就是更改 utils.py,如下所述:http: //highonpython.com/index.php/setting-up-ios-push-notifications-apns-with-pythondjango-through-pyapns/

而不是“沙盒”将其更改为“生产”。如果您的推送通知之前有效,它应该可以解决您的问题。

希望这可以帮助!

于 2013-02-22T19:15:49.113 回答