func refreshPurchasedProducts() async {
// Iterate through the user's purchased products.
for await verificationResult in Transaction.currentEntitlements {
switch verificationResult {
case .verified(let transaction):
// Check the type of product for the transaction
// and provide access to the content as appropriate.
...
case .unverified(let unverifiedTransaction, let verificationError):
// Handle unverified transactions based on your
// business model.
...
}
}
}
1条答案
按热度按时间jutyujz01#
每次用户启动您的应用时,您都可以使用Transaction的
currentEntitlements
属性从apple documentation恢复其购买,如下面的代码所示。字符串