Push Notification in production is not working

独自空忆成欢 提交于 2019-12-18 09:08:25

问题


I Have implemented this url.

Development mode notification is working but in production its not working. and shows errors.

  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' 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: Certificate  data  for 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: <f65ed342 4416c0bf e2a8c26a f3eb9a69 70780771 4eadb033 61ca8aec c28d454a> 
  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 

回答1:


First of all make sure you install production APN certificates on your server, not development certificates.

After that make sure, you are sending the notification to right server URL

  • Sandbox: gateway.sandbox.push.apple.com, port 2195. (for thedevelopment)
  • Production: gateway.push.apple.com, port 2195. (for the release)

Still you have the same problem, try this App. APN Tester



来源:https://stackoverflow.com/questions/34554680/push-notification-in-production-is-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!