Search code examples
iphoneapp-storeitunesin-app-purchasepasswordbox

SKPaymentQueue addTransactionObserver asking for App Store password on startup after in-app purchase


My app is using in-app purchases, and most of my users can purchase just fine without any problems. For these folks, my app downloads the content after the purchase succeeds and they are happy.

However, for a growing number of my users, once they complete a successful in-app purchase they are being asked for their App Store password every time the app starts up after that. I believe this is happening on the call to:

[[SKPaymentQueue defaultQueue] addTransactionObserver:observer];

which I am calling on startup in accordance with step 6 in Apple's in-app purchase guide:

My guess is that, for some reason, Apple's in-app purchase servers aren't registering that the transaction finished successfully - even though I call

[[SKPaymentQueue defaultQueue] finishTransaction:transaction];

when the transaction is completed and my content has been successfully downloaded.

2 questions:

  1. Is anyone else seeing this?

  2. Does anyone have a suggested fix?

BOUNTY EDIT:

Its a transaction which was made with a different Apple-ID. Thats why it cannot be finished unless you type in the right credentials into the dialog. The Question should be either:

  1. How can I prevent such dead transactions (transaction has not been finished, user has no network, meanwhile changes App-ID)?
  2. How can you prune the SkPaymentQueue?

Solution

  • I had the same problem.make sure that you call

    [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; 
    

    for all three states of the transactions: SKPaymentTransactionStatePurchased, SKPaymentTransactionStateRestored, SKPaymentTransactionStateFailed.