iOS push notifications: iOS logs "NOT delivering non-notifying push notification"

Viewed 182

Why is iOS not delivering push notifications to my device?

I am sending a push notification using curl, like so:

curl -v \
--http2 \
--header "apns-push-type: alert" \
--header "apns-priority: 10" \
--header "authorization: bearer $jwt" \
--header "apns-topic: ${BUNDLEID}" \
--data '{"aps": {"content-available": 1, "interruption-level": "active"}, "alert": {"title":"title", "body": "body"}}' \
"${URL}"

Unfortunately, when I look in Console.app, I see the log:

[uk.orth.pushExampleTemporary] Received remote notification request FDCA-F040 [ waking: 0, hasAlertContent: 0, hasSound: 0 hasBadge: 0 hasContentAvailable: 1 hasMutableContent: 0 pushType: Alert]

[uk.orth.pushExampleTemporary] NOT requesting DUET deliver content-available, non-notifiying push notification FDCA-F040 [pushType: Alert willNotifyUser: 0]
[uk.orth.pushExampleTemporary] NOT delivering non-notifying push notification FDCA-F040 [pushType: Alert willNotifyUser: 0]

enter image description here

1 Answers

JSON structure problem

I've noticed that I set the data payload to be something slightly wrong , which was caused by formatting my payload in bash instead of a type in programming language.

The line containing the payload (--data) should look like:

--data '{"aps": {"content-available": 1, "alert": {"title":"title", "body": "body"}}}' \

Avoiding this problem in the future

I've moved over to using a json file (ios_alert_message.json) to avoid these types of errors, using the curl command:

curl -v \
--http2 \
--header "apns-push-type: alert" \
--header "apns-priority: 10" \
--header "authorization: bearer $jwt" \
--header "apns-topic: ${BUNDLEID}" \
--header "Content-Type: application/json" \
--data @"$CURRENT_DIR/ios_alert_message.json" \
"${URL}"
Related