7

I've been banging my head against the wall for a few days with this, since everything used to work fine, but now that I've moved to Mountain Lion, XCode 4.5 and iOS5.1 and iOS6, this issue came along and I thought it might be related to the configuration switch.

I call [[SKPaymentQueue defaultQueue] restoreCompletedTransactions] and moments later paymentQueueRestoreCompletedTransactionsFinished is called, but there is no sign of any call to updatedTransactions. It's like the request got lost in space.

I'm also having a possibly related problem with purchases. If I try to repurchase an item using makePurchase, which from what I understand should also lead to a SKPaymentTransactionStateRestored, I get the "Already purchased.. download" message followed by the dreaded "Cannot connect to iTunes store..." with a "PaymentTransactionStateFailed" error code 2. What is error code 2?

The item is a normal non-consumable in-app puchase, and this happens when testing the StoreKit in sandbox mode.

I'm seeing others on this forum with similar issues with the only reply being that this is an intermittent bug i the StoreKit. Is this still the most plausible case?

Any news on this would be appreciated.

CAMOBAP
  • 5,523
  • 8
  • 58
  • 93
  • I see that this question is a year old. I am experiencing the exact same problem as described above. I wish to store the purchased items once returned by updatedTrasactions locally to retrieve them on application startup. In addition, I have added a new test user to resolve the "broken test user" case and still no joy. I do have the observer started in viewDidLoad: [[SKPaymentQueue defaultQueue] addTransactionObserver:self]; Please help us!!! – Spidey Jul 26 '14 at 21:21

2 Answers2

1

If you clear the purchase history more info here, or the user has never made a purchase before. paymentQueue:updatedTransactions will never be called. You need to add paymentQueueRestoreCompletedTransactionsFinished. Also to be sure check

queue.transactions.count == 0

All code here:

public func paymentQueueRestoreCompletedTransactionsFinished(_ queue: SKPaymentQueue) {
            print("paymentQueueRestoreCompletedTransactionsFinished",queue.transactions.count)
            if queue.transactions.count == 0 {
                //call FailedNotification
            }
        }
kiril kiroski
  • 806
  • 7
  • 8
0

paymentQueue:updatedTransactions: is only called when the state of transactions has changed.

If there are no previous transactions [[SKPaymentQueue defaultQueue] restoreCompletedTransactions] will not change the state of these transactions (because there are none) so paymentQueueRestoreCompletedTransactionsFinished is called without a call to paymentQueue:updatedTransactions:

I'm also having a possibly related problem with purchases. If I try to repurchase an item using makePurchase, which from what I understand should also lead to a SKPaymentTransactionStateRestored, I get the "Already purchased.. download" message followed by the dreaded "Cannot connect to iTunes store..." with a "PaymentTransactionStateFailed" error code 2. What is error code 2?

You need to call [[SKPaymentQueue defaultQueue] finishTransaction:] after handling a successful transaction.

Thomm
  • 506
  • 5
  • 12