We are using the below getPushToken()
function to retrieve live activity token. However there are cases in production such that await activity.getPushToken()
never finish. i.e. have logs of start event and no return or end event, the code path stuck at the guard statement.
Do anyone face same issue and if can advise what can go wrong and how best to handle such cases?
// log start event
guard let pushToken = await activity.getPushToken(),
!pushToken.isEmpty else {
// log return event
return
}
// log end event
extension Activity {
public func getPushToken() async -> String? {
for await data in pushTokenUpdates {
return data.map { String(format: "%02x", $0) }.joined()
}
return nil
}
}