0

我是应用内购买的新手。我正在使用 RevenueCat。我像这样恢复购买:

Purchases.shared.restoreTransactions { (purchaserInfo, error) in
}

当没有购买的产品时,我想向用户显示这样的警报消息:

您没有要恢复的购买

如何确定没有订阅的产品?

4

1 回答 1

5

您将检查purchaserInfo客户是否拥有有效权利或购买了您正在寻找的产品 - 可能类似于您在购买完成后所做的检查。

Purchases.shared.restoreTransactions { (purchaserInfo, error) in
                
    if let e = error {
        showErrorAlert(message: e.localizedDescription)
        return
    }
    
    if purchaserInfo?.entitlements["premium"]?.isActive != true {
        showErrorAlert(title: "Nothing found to restore ", message: "We couldn't find any active subscriptions to restore. Make sure you're signed in with the correct Apple account and try again.")
        return
    } else {
        showSuccess(title: "Subscription restored ", message: nil)
    }
    
}
于 2021-05-10T15:09:01.503 回答