'谢谢 - 您的交易成功了#39;弹出 - Storekit代码的哪一部分触发它?

时间:2016-05-03 18:19:36

标签: ios swift2 in-app-purchase

我试图拦截/延迟App Store交易成功弹出一个交易成功,直到我收到收据后才能对收据ID,产品ID等进行一些验证。

但是,我似乎无法找到实际触发它的代码(我认为它是PaymentQueue中的内容)。

思想?

1 个答案:

答案 0 :(得分:-1)

func paymentQueue(queue: SKPaymentQueue!, updatedTransactions transactions: [AnyObject]!) {
        println("Received Payment Transaction Response from Apple");

        for transaction:AnyObject in transactions {
            if let trans:SKPaymentTransaction = transaction as? SKPaymentTransaction{
                switch trans.transactionState {
                case .Purchased:
                    println("Product Purchased");
                    SKPaymentQueue.defaultQueue().finishTransaction(transaction as SKPaymentTransaction)
                    break;
                case .Failed:
                    println("Purchased Failed");
                    SKPaymentQueue.defaultQueue().finishTransaction(transaction as SKPaymentTransaction)
                    break;
                    // case .Restored:
                    //[self restoreTransaction:transaction];
                default:
                    break;
                }
            }
        }

    }

image 1 image 2