I wanted to integrate location push extension to my app I followed the documentations and applied for the entitlement.
I followed these steps:
I added com.apple.developer.location.push to my app entitlement as follows
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>production</string>
<key>com.apple.developer.location.push</key>
<true/>
</dict>
</plist>
I got the location push token and formatted it to string
locationManager.startMonitoringLocationPushes(completion: { data, error in
if let error = error {
print(error)
return
}
guard let data = data else { return }
let token = data.reduce("", {$0 + String(format: "%02X", $1)})
print(token)
})
I exported the APNS push certificate after enabling additional capabilities from the app store connect and keychain. then converted to pem format
openssl x509 -in aps_development.cer -inform der -out PushCert.pem
openssl pkcs12 -nocerts -out PushChatKey.pem -in PushChatKey.p12
Tried to send push using command line
TOPIC="com.myapp.location-query"
CERTIFICATE_FILE_NAME="./test.p12:1234"
CERTIFICATE_KEY_FILE_NAME="./new2k.pem"
APNS_HOST_NAME="api.sandbox.push.apple.com"
DEVICE_TOKEN="FE979AB7DAC975DD19E2F977EDB9BCD13C870AFD97D8D20955039666AA5DXXXX"
curl -v \
-d '{}' \
--header "apns-topic: $TOPIC" \
--header "apns-push-type: location" \
--http2 \
--cert $CERTIFICATE_FILE_NAME \
--cert-type P12 \
--http2 https://$APNS_HOST_NAME/3/device/$DEVICE_TOKEN
and the response is
* Trying 17.188.138.70:443...
* Connected to api.sandbox.push.apple.com (17.188.138.70) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
* CApath: none
* 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, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (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.development.push.apple.com; OU=management:idms.group.533599; O=Apple Inc.; ST=California; C=US
* start date: Dec 10 00:29:46 2021 GMT
* expire date: Jan 9 00:29:45 2023 GMT
* subjectAltName: host "api.sandbox.push.apple.com" matched cert's "api.sandbox.push.apple.com"
* issuer: CN=Apple Public Server RSA CA 12 - G1; O=Apple Inc.; ST=California; C=US
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x11c80ce00)
> POST /3/device/FE979AB7DAC975DD19E2F977EDB9BCD13C870AFD97D8D20955039666AA5DXXXX HTTP/2
> Host: api.sandbox.push.apple.com
> user-agent: curl/7.77.0
> accept: */*
> apns-topic: com.myapp.location-query
> apns-push-type: location
> content-length: 2
> content-type: application/x-www-form-urlencoded
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 1000)!
* We are completely uploaded and fine
< HTTP/2 400
< apns-id: CA7EC88D-E839-318B-D9DC-DCB533F50808
<
* Connection #0 to host api.sandbox.push.apple.com left intact
{"reason":"TopicDisallowed"}%
But I always get TopicDisallowed response
Did I miss something?