支付队列没有调用观察者对象来更新交易,为啥?

Posted

技术标签:

【中文标题】支付队列没有调用观察者对象来更新交易,为啥?【英文标题】:Payment queue does not call observer object about updated transaction, why?支付队列没有调用观察者对象来更新交易,为什么? 【发布时间】:2014-10-29 22:52:18 【问题描述】:

当用户按BUY 并添加付款时..

@IBAction func buyProduct(sender: AnyObject) 

    let payment = SKPayment(product: product)
    SKPaymentQueue.defaultQueue().addPayment(payment)

.. 我希望出现一个蓝色弹出窗口来批准购买,然后会调用观察者。

但对我来说不是。知道为什么吗?我的 iTunes Connect 有什么问题吗?

在加载 viewController 之前,我调用了

SKPaymentQueue.canMakePayments() 返回 true,我开始了产品请求:

let pr = SKProductsRequest(productIdentifiers: NSSet(object: "com.xxx"))
pr.delegate = self
pr.start()

并调用了func productsRequest(request: SKProductsRequest!, didReceiveResponse response: SKProductsResponse!) 委托。

我正在使用this教程

【问题讨论】:

你设置支付队列观察者了吗? 【参考方案1】:

你需要打电话

SKPaymentQueue.defaultQueue().addTransactionObserver(self)

打电话之前

SKPaymentQueue.defaultQueue().addPayment(payment)

【讨论】:

它有效,顺便说一句,你知道为什么App can not connect to iTunes Store:***.com/questions/26507849/…

以上是关于支付队列没有调用观察者对象来更新交易,为啥?的主要内容,如果未能解决你的问题,请参考以下文章