我可以在使用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>
在日志中,引用是:Traceback(没有帧的失败):
<class'twisted.internet.error.ConnectionDone'>: Connection was closed cleanly.]
我怎样才能找到解决方案?
答案 0 :(得分:2)
所以我实际上弄清楚了问题是什么。事实证明,我的应用程序仍在向Apple的Sandbox Server发送通知。 Apple将拒绝在特定限制后发送任何通知。我所要做的就是更改utils.py,如下所示:http://highonpython.com/index.php/setting-up-ios-push-notifications-apns-with-pythondjango-through-pyapns/
而不是'沙盒'将其更改为'生产'。如果您的推送通知之前有效,它应该可以解决您的问题。
希望这有帮助!