idelfonsog2
(Idelfonso Gutierrez)
1
I have decided to wrap the app delegate method's for remote notifications with Continuation and I have created the following method
func fetchDeviceToken() async throws -> String {
return try await withCheckedThrowingContinuation { continuation in
self.activeContinuation = continuation
Task {
await MainActor.run {
UIApplication.shared.registerForRemoteNotifications()
}
}
}
}
My understanding is that within the withCheckedThrowingContinuation closure, we should call the method for the listener to start getting the events
once UIApplication.shared.registerForRemoteNotifications() gets called, the delegate calls the activeContinuation but its nil to the context switching within withCheckedThrowingContinuation
idelfonsog2
(Idelfonso Gutierrez)
2
As I look at it more, we should assign the continuation first then call the method that will trigger the listening of those events, am I sort of in the right direction?