0

When user press BUY and payment is added ..

@IBAction func buyProduct(sender: AnyObject) {

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

.. I would expect that a blue popup comes up to approve purchase, and then observer will get called.

But not in my case. Any idea why? Anything wrong in my iTunes Connect?

Before when viewController was loaded I called

SKPaymentQueue.canMakePayments() which returns true and I started a product request:

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

and func productsRequest(request: SKProductsRequest!, didReceiveResponse response: SKProductsResponse!) delegate was called.

I am using this tutorial

János
  • 32,867
  • 38
  • 193
  • 353

1 Answers1

4

You need to call

SKPaymentQueue.defaultQueue().addTransactionObserver(self)

before calling

SKPaymentQueue.defaultQueue().addPayment(payment)
ZeMoon
  • 20,054
  • 5
  • 57
  • 98
  • it works, btw, do you have any idea why `App can not connect to iTunes Store`: http://stackoverflow.com/questions/26507849/payment-queue-observer-returns-can-not-connect-to-itunes-store-why – János Oct 30 '14 at 12:43