I'm trying to restore an individual purchase under iOS 17 and StoreKit 2. After tapping the restore button I need to download a file to complete the necessary restore process.
How do I listen to a restored purchase to download the necessary file?
I'm starting the restore process with this code:
.toolbar {
ToolbarItem {
Button("Restore") {
isRestoring = true
Task.detached {
defer { isRestoring = false }
try await AppStore.sync()
}
}
.disabled(isRestoring)
}
}
When I tap the restore button the only thing it does is show an Alert with the message: "Sign in with Apple ID. Press OK to simulate authenthicating with an Apple ID [Enviroment: Xcode]" And nothing else happens.
I need to know when the process is complete to download a file.
Thank you!
I found this sample code on Apple's documentation (currentEntitlements) that worked for me.