菜鸟教程小白 发表于 2022-12-12 10:00:16

ios - 生产中的推送通知不起作用


                                            <p><p>我已经实现了<a href="http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1" rel="noreferrer noopener nofollow">this</a>网址。</p>

<p>开发模式通知正在工作,但在生产中它不起作用。并显示错误。</p>

<pre><code>dakshas-iMac:alootamatar daksha$ php push_demo.php

Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in /Users/daksha/Desktop/alootamatar/push_demo.php on line 18

Warning: stream_socket_client(): unable to connect to ssl://gateway.push-apple.com:2195 (php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known) in /Users/daksha/Desktop/alootamatar/push_demo.php on line 18
Failed to connect: 0 php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known
iMac:alootamatar daksha$ php push_demo.php

Warning: stream_socket_client(): Unable to set private key file `/Users/daksha/Desktop/alootamatar/cert.pem&#39; in /Users/daksha/Desktop/alootamatar/push_demo.php on line 18

Warning: stream_socket_client(): failed to create an SSL handle in /Users/daksha/Desktop/alootamatar/push_demo.php on line 18

Warning: stream_socket_client(): Failed to enable crypto in /Users/daksha/Desktop/alootamatar/push_demo.php on line 18

Warning: stream_socket_client(): unable to connect to ssl://gateway.push.apple.com:2195 (Unknown error) in /Users/daksha/Desktop/alootamatar/push_demo.php on line 18
Failed to connect: 0


After using APNS tester got response
2016-01-01 09:37:08 +0000: Set SSL connection
2016-01-01 09:37:08 +0000: Set peer domain name gateway.push.apple.com
2016-01-01 09:37:08 +0000: Keychain Opened
2016-01-01 09:37:08 +0000: Certificatedatafor Apple Production IOS Push Services: com.daksha.alootamatar initialized successfully
2016-01-01 09:37:08 +0000: Sec Identity created
2016-01-01 09:37:08 +0000: Client certificate created
2016-01-01 09:37:10 +0000: Connected
2016-01-01 09:37:10 +0000: Token: &lt;f65ed342 4416c0bf e2a8c26a f3eb9a69 70780771 4eadb033 61ca8aec c28d454a&gt;
2016-01-01 09:37:10 +0000: Written 92 bytes sending data to gateway.push.apple.com:2195

2016-01-01 09:37:10 +0000: Disconnected from server gateway.push.apple.com:2195
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>首先确保在服务器上安装生产 APN 证书,而不是开发证书。</p>

<p>确保您将通知发送到正确的服务器 URL</p>

<ul>
<li>沙盒:<code>gateway.sandbox.push.apple.com</code>,端口 <code>2195</code>。 (为了
发展)</li>
<li>生产:<code>gateway.push.apple.com</code>,端口 <code>2195</code>。 (用于发布)</li>
</ul>

<p>你还是有同样的问题,试试这个应用程序。 <a href="https://itunes.apple.com/us/app/apn-tester-free/id626590577?mt=12" rel="noreferrer noopener nofollow">APN Tester</a> </p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 生产中的推送通知不起作用,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/34554680/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/34554680/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 生产中的推送通知不起作用