我何时/如何在SwiftyStoreKit中触发completeTransactions回调

时间:2018-12-18 21:30:29

标签: swift swiftystorekit

我真的找不到任何详细的解释,但是如何从SwiftyStoreKit触发以下回调。

    SwiftyStoreKit.completeTransactions(atomically: true) { purchases in
        for purchase in purchases {
            switch purchase.transaction.transactionState {
            case .purchased, .restored:
                if purchase.needsFinishTransaction {
                    // TODO: Set flags here that the user has now purchased the product
                    SwiftyStoreKit.finishTransaction(purchase.transaction)
                }
            // Unlock content
            case .failed, .purchasing, .deferred:
                break // do nothing
            }
        }
    }

此外,如果您的应用正在从服务器下载内容,则仅需要调用finishTransaction?

0 个答案:

没有答案