Hi all,
I'm trying to implement starting Live Activities with push notifications according to this article:
I'm using Xcode 15.1 beta 3, I have run my tests on a physical device with iOS 17.2 as well as the simulator with iOS 17.2
My problem is I can't seem to be able to get the pushToStartToken
needed to start the live activities. I have subscribed to the pushToStartTokenUpdates
but I never get any updates.
Here is the code I used:
Task {
do {
for try await data in Activity<DailyGoalActivityAttributes>.pushToStartTokenUpdates {
let token = data.map {String(format: "%02x", $0)}.joined()
print("Activity token: \(token)")
}
} catch {
print(error)
}
}
Any help would be greatly appreciated.
Thanks,
HS
My observations have been: the new api (from iOS 17.2) Activity<ActivityAttributes>.pushToStartTokenUpdates returns the pushToStartToken is when Activity<ActivityAttributes>.request has been made (when app is in foreground).
This blog talks about the sequence but it doesn't seem to be working as designed. https://apnspush.com/how-to-start-and-update-live-activities-with-push-notifications