iOS 16 Beta Live Activities Push Notification DeviceTokenNotForTopic

Hello, I created a demo app for iOS 16 Live Activities through ActivityKit. I experienced an issue about update or ending an activity by Push Notification. I use pushToken data of activity to update. I got the error below. How can I solve the issue? Many thanks in advance!

{"reason":"DeviceTokenNotForTopic"}

And this is the APNS curl.

curl -v -d '{
"aps": {
    "timestamp": 1659466849,
    "event": "end",
    "content-state": {
        "courierName": "Anne Johnson",
        "deliveryTime": 1659466849
    }
},
"aditional-info": "Test"
}' -H "apns-topic: com.batikan.LiveActivityKit" -H "apns-priority: 10" --http2 --cert certificate-and-privatekey.pem https://api.sandbox.push.apple.com/3/device/809674441f3f54310651052594a78bea3abdf8a4a56ac4d42786aae49d694122df83cd691adc480ae4c0ba198565bb0b111a2d69ca0a0e491caa0f2471938ebdca387556c06ed1d1c4eb2faf62f7669e
Answered by Technology Evangelist in 726888022

Hey there! Thanks for your interest in Live Activities!

There are a few additional things you should know when pushing updates to your Live Activities:

  • Certificate-based authentication is not supported for these APNs pushes. You should use token-based authentication instead. The process for setting up token-based authentication is described in the Establishing a Token-Based Connection to APNs documentation article.
  • APNs pushes for Live Activities require setting the apns-push-type header to a value of liveactivity. Judging from your code sample, you have not provided an apns-push-type in your request. Refer to the table of header fields in the Sending Notification Requests to APNs documentation article for more information on how to set this up.
  • Your apns-topic header should be of the format <bundleID>.push-type.liveactivity, where <bundleID> is replaced with your bundle ID. Assuming com.batikan.LiveActivityKit is your app's bundle ID in the example above, this would result in the string com.batikan.LiveActivityKit.push-type.liveactivity.

The Displaying live data on the Lock Screen with Live Activities and Sending Notification Requests to APNs documentation articles will be updated with this new guidance in an upcoming update.

I also have the same issue, I hope someone from Apple can clarify it!

Does anyone know how to fix this?

Hey there! Thanks for your interest in Live Activities!

There are a few additional things you should know when pushing updates to your Live Activities:

  • Certificate-based authentication is not supported for these APNs pushes. You should use token-based authentication instead. The process for setting up token-based authentication is described in the Establishing a Token-Based Connection to APNs documentation article.
  • APNs pushes for Live Activities require setting the apns-push-type header to a value of liveactivity. Judging from your code sample, you have not provided an apns-push-type in your request. Refer to the table of header fields in the Sending Notification Requests to APNs documentation article for more information on how to set this up.
  • Your apns-topic header should be of the format <bundleID>.push-type.liveactivity, where <bundleID> is replaced with your bundle ID. Assuming com.batikan.LiveActivityKit is your app's bundle ID in the example above, this would result in the string com.batikan.LiveActivityKit.push-type.liveactivity.

The Displaying live data on the Lock Screen with Live Activities and Sending Notification Requests to APNs documentation articles will be updated with this new guidance in an upcoming update.

Thanks @paan, The timestamp is important, after adding it, mine works too.

Thanks @paan, The timestamp is very important, after adding it, mine works too, when end a live activity, aps must have content-state key, if not live activity can‘t end

iOS 16 Beta Live Activities Push Notification DeviceTokenNotForTopic
 
 
Q