Apple推送通知卷曲:(16)HTTP2框架层出错

时间:2016-09-09 11:50:28

标签: curl push-notification apple-push-notifications

我在ubuntu终端上运行此命令

  

curl --verbose -H'apns-topic:Skios.TripBruCACT'--header“Content-Type:application / json”--data'{“aps”:{“content-available”:1,“alert “:”hi“,”sound“:”默认“}}'--cert /home/mohamed/Downloads/Prod2.pem:a1B23 --http2'https://api.push.apple.com/3/device/19297dba97212ac6fd16b9cd50f2d86629aed0e49576b2b52ed05086087da802'

但它返回卷曲:(16)HTTP2框架层中的错误

以下是整个结果

*   Trying 17.188.145.163...
* Connected to api.push.apple.com (17.188.145.163) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt CApath: none
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Request CERT (13):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS handshake, CERT verify (15):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=api.push.apple.com; OU=management:idms.group.533599; O=Apple Inc.; ST=California; C=US
*  start date: Aug 28 19:03:46 2015 GMT
*  expire date: Sep 26 19:03:46 2017 GMT
*  subjectAltName: host "api.push.apple.com" matched cert's "api.push.apple.com"
*  issuer: CN=Apple IST CA 2 - G1; OU=Certification Authority; O=Apple Inc.; C=US
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* TCP_NODELAY set
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0xdb69a0)
> POST /3/device/19297dba97212ac6fd16b9cd50f2d86629aed0e49576b2b52ed05086087da802 HTTP/1.1
> Host: api.push.apple.com
> User-Agent: curl/7.50.0
> Accept: */*
> apns-topic: Skios.TripBruCACT
> Content-Type: application/json
> Content-Length: 62
> 
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
* We are completely uploaded and fine
* Closing connection 0
* TLSv1.2 (OUT), TLS alert, Client hello (1):
curl: (16) Error in the HTTP2 framing layer

但我在最后一行得到了这个错误

  

卷曲:(16)HTTP2框架层错误

1 个答案:

答案 0 :(得分:0)

我了解到您正在尝试使用.pem文件来测试推送通知。请尝试以下步骤。

将终端的目录更改为您的.pem文件所包含的文件夹,而不是提供证书路径。

然后,运行以下命令,

对于开发APNS:

curl -d'{“ aps”:{“ alert”:“ hi”,“ sound”:“ default”}}''--cert yourpem.pem :-H“ apns-主题: yourbundleID ” --http2 https://api.development.push.apple.com/3/device/ 您的设备令牌

对于生产型APNS:

curl -d'{“ aps”:{“ alert”:“ hi”,“ sound”:“ default”}}''--cert yourpem.pem :-H“ apns-主题: yourbundleID ” --http2 https://api.push.apple.com/3/device/ 您的设备令牌