2013-02-22 79 views
2

在使用Twisted和pyapns之前,我能夠發送推送通知。我不得不重新啓動我的EC2實例,並啓動了我的Web服務器,並開始扭曲。重啓後,我一直無法發送和接收推送通知,我查了扭曲的日誌,這是我發現:Twisted和pyapns推送通知錯誤

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> 

在日誌中,引用的是:回溯(故障不幀) :

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

我該如何解決這個問題?

回答

2

所以我實際上找出了問題所在。事實證明,我的應用程序仍在向Apple的Sandbox Server發送通知。蘋果將​​否認任何通知在一定限制後發送。我所要做的就是更改utils.py,如下所示:http://highonpython.com/index.php/setting-up-ios-push-notifications-apns-with-pythondjango-through-pyapns/

而不是'沙箱'將其更改爲'生產'。它應該解決您的問題,如果您的推送通知之前工作。

希望這會有所幫助!

+1

您的網址不再有效。你有更新的嗎?謝謝。 – Frost 2014-01-24 21:20:07