I'm implementing AppStore.showManageSubscriptions(in:)
, I can't find the callbacks to find out what option a user selected such as cancel/dismiss/swipe down to dismiss, cancel subscription, purchase subscription, etc. I need to run some code based on these 3 situations. How do I access the callbacks or delegate functions?
if let window = UIApplication.shared.connectedScenes.first {
Task {
do {
try await AppStore.showManageSubscriptions(in: window as! UIWindowScene)
} catch {
print(error)
}
}
}
To run code after the user is done with the manage subscriptions sheet, just put that code after the showManageSubscriptions
call.
To distinguish between what the user has done in the manage subscriptions sheetm you can check your subscriptions' statuses before and after the showManageSubscriptions
call, and compare.
do {
let before = ... // get subscription status before
try await AppStore.showManageSubscriptions(in: window as! UIWindowScene)
let after = ... // get subscription status after
// compare before and after
} catch {
print(error)
}