取消购买SwiftyStoreKit

时间:2018-07-19 09:56:16

标签: swift storekit swiftystorekit

我正在使用SwiftyStoreKit库来购买应用程序中的产品。我正在使用此购买功能,该功能运行良好。

func purchase_product()
{
    // start network circle
    NetworkActivityIndicatorManager.NetwordOperationStarted()

    SwiftyStoreKit.purchaseProduct(purchase_bundle_id, quantity: 1, atomically: true)
    {
        result in

        // stop network circle
        NetworkActivityIndicatorManager.NetwordOperationFinished()

        switch result {
        case .success(let purchase):
                print("Purchase Success: \(purchase.productId)")
        case .error(let error):
                switch error.code {
            case .unknown: print("Unknown error. Please contact support")
            case .clientInvalid: print("Not allowed to make the payment")
            case .paymentCancelled: break
            case .paymentInvalid: print("The purchase identifier was invalid")
            case .paymentNotAllowed: print("The device is not allowed to make the payment")
            case .storeProductNotAvailable: print("The product is not available in the current storefront")
            case .cloudServicePermissionDenied: print("Access to cloud service information is not allowed")
            case .cloudServiceNetworkConnectionFailed: print("Could not connect to the network")
            case .cloudServiceRevoked: print("User has revoked permission to use this cloud service")
            }
        }
    }
}

如果从用户开始购买交易起经过了10秒以上,但没有任何反应(由于互联网连接不足),我想取消购买交易。有什么方法可以取消购买产品的请求?

0 个答案:

没有答案