Reputation: 2060
i do run this command on ubuntu terminal
curl --verbose -H 'apns-topic: Skios.TripBruCACT' --header "Content-Type: application/json" --data '{"aps":{"content-available":1,"alert":"hi","sound":"default"}}' --cert /home/mohamed/Downloads/Prod2.pem:a1B23 --http2 'https://api.push.apple.com/3/device/19297dba97212ac6fd16b9cd50f2d86629aed0e49576b2b52ed05086087da802'
but it return curl: (16) Error in the HTTP2 framing layer
Here are the whole result
* 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
but i got in last line this error
curl: (16) Error in the HTTP2 framing layer
Upvotes: 16
Views: 7382
Reputation: 1031
This occurs when either being in the wrong mode (sandbox vs. production) or having a mixture of sandbox and production in your arguments to curl. It is most likely not the curl issue that existed a few years ago.
When you generate your certificate, generate both certificates - Sandbox and Sandbox + Production. Apple will generate the 'sandbox' as 'development', which those two terms are used interchangeably - and you might think that because you aren't in a sandbox, that you are by default in production path that includes development.
Create two curl commands, one for sandbox and one for production. Besides the certificate, you need to change the http reference in sandbox to "https://api.sandbox.push.apple.com".
What is most likely happening above is that you generated the app from xcode (sandbox/development) and instead you are using the http reference for testflight (production), so it's giving you the ambiguous error for what is most likely a specific issue.
The api references change, so check the latest on the apple api. Think in terms of where your build came from - xcode or testflight/app store, and then that would determine if you use sandbox or production.
Upvotes: 0
Reputation: 1233
I understand that you are trying to test the push notification by using your .pem file. Please try the following steps.
Instead of giving the certificate path, change the directory of the terminal to the folder which your .pem file contains.
then, run the following command,
For Development APNS:
curl -d '{"aps":{"alert":"hi","sound":"default"}}' --cert yourpem.pem: -H "apns-topic: yourbundleID" --http2 https://api.development.push.apple.com/3/device/yourdevicetoken
For Production APNS:
curl -d '{"aps":{"alert":"hi","sound":"default"}}' --cert yourpem.pem: -H "apns-topic: yourbundleID" --http2 https://api.push.apple.com/3/device/yourdevicetoken
Upvotes: -1