Curl to APNS 适用于 mac,但不适用于 Windows?
Curl to APNS works on mac, but not on Windows?
发生了一些非常奇怪的事情。在我的 mac 上,我可以 curl 到 Apple 的 http2 APNS api,我收到通知以及以下响应:
POST /3/device/{MYTOKEN} HTTP/1.1
Host: api.push.apple.com
User-Agent: curl/7.49.1
Accept: */*
apns-topic: com.domain.myapp
Content-Length: 40
Content-Type: application/x-www-form-urlencoded
Connection state changed (MAX_CONCURRENT_STREAMS updated)!
We are completely uploaded and fine
HTTP 1.0, assume close after body
HTTP/2 200
apns-id: 9DF86348-7133-8AF2-746D-EC1528769AD8
Closing connection 0
TLSv1.2 (OUT), TLS alert, Client hello (1):
如果我在我希望从(Windows 服务器)发送通知的服务器上执行相同操作,我会得到完全相同的响应! - 但设备上没有通知??
知道这是怎么回事吗?
好的 - 我解决了!
问题出在发布数据中的引号字符。正确的格式应该是:
curl -d "{\"aps\":{\"alert\":\"test\",\"sound\":\"default\"}}"
我在外面使用了单引号,它在 mac 上有效,但在 windows 上无效。奇怪的是,我在windows machine 上收到了apple 的ok 消息,但没有任何通知。
发生了一些非常奇怪的事情。在我的 mac 上,我可以 curl 到 Apple 的 http2 APNS api,我收到通知以及以下响应:
POST /3/device/{MYTOKEN} HTTP/1.1
Host: api.push.apple.com
User-Agent: curl/7.49.1
Accept: */*
apns-topic: com.domain.myapp
Content-Length: 40
Content-Type: application/x-www-form-urlencoded
Connection state changed (MAX_CONCURRENT_STREAMS updated)!
We are completely uploaded and fine
HTTP 1.0, assume close after body
HTTP/2 200
apns-id: 9DF86348-7133-8AF2-746D-EC1528769AD8
Closing connection 0
TLSv1.2 (OUT), TLS alert, Client hello (1):
如果我在我希望从(Windows 服务器)发送通知的服务器上执行相同操作,我会得到完全相同的响应! - 但设备上没有通知??
知道这是怎么回事吗?
好的 - 我解决了!
问题出在发布数据中的引号字符。正确的格式应该是:
curl -d "{\"aps\":{\"alert\":\"test\",\"sound\":\"default\"}}"
我在外面使用了单引号,它在 mac 上有效,但在 windows 上无效。奇怪的是,我在windows machine 上收到了apple 的ok 消息,但没有任何通知。