2

我正在尝试使用https://github.com/samuraisam/pyapns/向我们的 iPhone 应用程序发送通知。

我已经测试过手动发送通知,并确认我们可以成功发送。我们正在寻找一个强大的解决方案,并且听说过关于 pyapns 的好消息。然而,这是我们在 twistd.log 中看到的日志输出,我们从未收到通知。

主要区别在于:

  1. 我们正在使用 pyapns
  2. 我们使用的是不同的证书——特别是,当我们手动发送通知时,我们同时提供了密钥和证书——然后提供密码来验证读取证书。对于 pyapns,我们创建了一个组合的 cert + 密钥,并删除了密码。但我们仍然无法收到通知。

我不确定根本原因是什么——如果证书有问题或者我们为什么无法发送通知。

以下是来自 twistd.log 的日志:

2012-04-04 01:21:51+0000 [-] Log opened.
2012-04-04 01:21:51+0000 [-] twistd 12.0.0 (/usr/bin/python 2.7.2) starting up.
2012-04-04 01:21:51+0000 [-] reactor class: twisted.internet.epollreactor.EPollReactor.
2012-04-04 01:21:51+0000 [-] Site starting on 7077
2012-04-04 01:21:51+0000 [-] Starting factory <twisted.web.server.Site instance at 0x1f2a908>
2012-04-04 01:31:57+0000 [HTTPChannel,0,127.0.0.1] APNSService __init__
2012-04-04 01:31:57+0000 [HTTPChannel,0,127.0.0.1] 127.0.0.1 - - [04/Apr/2012:01:31:57 +0000] "POST / HTTP/1.1" 200 114 "-" "xmlrpclib.py/1.0.1 (by www.pythonware.com)"
2012-04-04 01:34:32+0000 [HTTPChannel,1,127.0.0.1] APNSService write (connecting)
2012-04-04 01:34:32+0000 [HTTPChannel,1,127.0.0.1] APNSClientContextFactory ssl_cert_file={FROM_STRING}
2012-04-04 01:34:32+0000 [HTTPChannel,1,127.0.0.1] Starting factory <pyapns.server.APNSClientFactory instance at 0x2065b48>
2012-04-04 01:34:32+0000 [HTTPChannel,1,127.0.0.1] APNSClientFactory startedConnecting
2012-04-04 01:34:32+0000 [Uninitialized] APNSProtocol connectionMade
2012-04-04 01:34:32+0000 [Uninitialized] APNSProtocol sendMessage msg=00002079d7b66de69c6f5e78e5eef9d37d5c69b7b6e7adbdeba75ef5af5ce3b737dde7001a7b22617073223a7b22616c657274223a
2248656c6c6f21227d7d
2012-04-04 01:34:32+0000 [Uninitialized] 127.0.0.1 - - [04/Apr/2012:01:34:31 +0000] "POST / HTTP/1.1" 200 114 "-" "xmlrpclib.py/1.0.1 (by www.pythonware.com)"
2012-04-04 01:34:32+0000 [APNSProtocol (TLSMemoryBIOProtocol),client] APNSProtocol connectionLost
2012-04-04 01:34:32+0000 [APNSProtocol (TLSMemoryBIOProtocol),client] APNSClientFactory clientConnectionLost reason=[Failure instance: Traceback (failure with no frames): <clas
s 'twisted.internet.error.ConnectionDone'>: Connection was closed cleanly.
    ]
2012-04-04 01:34:32+0000 [APNSProtocol (TLSMemoryBIOProtocol),client] <twisted.internet.tcp.Connector instance at 0x2065c68> will retry in 2 seconds
2012-04-04 01:34:32+0000 [APNSProtocol (TLSMemoryBIOProtocol),client] Stopping factory <pyapns.server.APNSClientFactory instance at 0x2065b48>
2012-04-04 01:34:35+0000 [-] Starting factory <pyapns.server.APNSClientFactory instance at 0x2065b48>
2012-04-04 01:34:35+0000 [-] APNSClientFactory startedConnecting
2012-04-04 01:34:35+0000 [Uninitialized] APNSProtocol connectionMade
2012-04-04 01:34:53+0000 [HTTPChannel,2,127.0.0.1] APNSService read (connecting)
2012-04-04 01:34:53+0000 [HTTPChannel,2,127.0.0.1] APNSClientContextFactory ssl_cert_file={FROM_STRING}
2012-04-04 01:34:53+0000 [HTTPChannel,2,127.0.0.1] Starting factory <pyapns.server.APNSFeedbackClientFactory instance at 0x206ccb0>
2012-04-04 01:34:53+0000 [HTTPChannel,2,127.0.0.1] APNSFeedbackClientFactory startedConnecting
2012-04-04 01:34:53+0000 [Uninitialized] feedbackHandler connectionMade
2012-04-04 01:34:53+0000 [APNSFeedbackHandler (TLSMemoryBIOProtocol),client] feedbackHandler connectionLost [Failure instance: Traceback (failure with no frames): <class 'twist
ed.internet.error.ConnectionDone'>: Connection was closed cleanly.
    ]
2012-04-04 01:34:53+0000 [APNSFeedbackHandler (TLSMemoryBIOProtocol),client] 127.0.0.1 - - [04/Apr/2012:01:34:53 +0000] "POST / HTTP/1.1" 200 138 "-" "xmlrpclib.py/1.0.1 (by ww
w.pythonware.com)"
2012-04-04 01:34:53+0000 [APNSFeedbackHandler (TLSMemoryBIOProtocol),client] APNSFeedbackClientFactory clientConnectionLost reason=[Failure instance: Traceback (failure with no
 frames): <class 'twisted.internet.error.ConnectionDone'>: Connection was closed cleanly.
    ]
2012-04-04 01:34:53+0000 [APNSFeedbackHandler (TLSMemoryBIOProtocol),client] Stopping factory <pyapns.server.APNSFeedbackClientFactory instance at 0x206ccb0>
4

0 回答 0