【问题标题】: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教程

【问题讨论】:

  • 你设置支付队列观察者了吗?

标签: ios swift in-app-purchase app-store-connect


【解决方案1】:

你需要打电话

SKPaymentQueue.defaultQueue().addTransactionObserver(self)

打电话之前

SKPaymentQueue.defaultQueue().addPayment(payment)

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2019-12-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-02-01
  • 2014-09-24
相关资源
最近更新 更多