Note that there are some explanatory texts on larger screens.

plurals
  1. POTransaction comes back after finishTransaction: has been called on it
    primarykey
    data
    text
    <p>I am using in-app purchase for an iPhone app. I have a class that acts as <code>SKProductsRequestDelegate</code> and <code>SKPaymentTransactionObserver</code>, and it's all working fine in the currently released version available on iTunes.</p> <p>However, after recently adding a new non-consumable product and testing it within the Sandbox environment, I'm now encountering a strange problem. Every time I launch the app, the purchase I made yesterday reappears in the transactions list passed to me by <code>paymentQueue:updatedTransactions:</code>, despite the fact that I had called <code>[[SKPaymentQueue defaultQueue] finishTransaction:transaction]</code> already (several times). It's undead!</p> <p>In my <code>paymentQueue:updatedTransactions:</code> implementation, I have:</p> <pre><code>for (SKPaymentTransaction* transaction in transactions) switch (transaction.transactionState) { case SKPaymentTransactionStatePurchased: case SKPaymentTransactionStateRestored: { .... DDLog(@"Transaction for %@ occurred originally on %@.", transaction.payment.productIdentifier, transaction.originalTransaction.transactionDate); .... </code></pre> <p>I then process the purchase, download the user content and finally, in another method, do this:</p> <pre><code>for (SKPaymentTransaction* transaction in [[SKPaymentQueue defaultQueue] transactions]) if (([transaction.payment.productIdentifier isEqualToString:theParser.currentProductID]) &amp;&amp; ((transaction.transactionState==SKPaymentTransactionStatePurchased) || (transaction.transactionState==SKPaymentTransactionStateRestored)) ) { DDLog(@"[[ Transaction will finish: product ID = %@; date = %@ ]]", transaction.payment.productIdentifier, transaction.transactionDate); [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; } </code></pre> <p>As you may have noticed, I'm not holding on to the original transaction object for the sake of simplicity, and it's relatively easy to find it later from the call to <code>[[SKPaymentQueue defaultQueue] transactions]</code>. Regardless, I do indeed see the expected output; that the transaction is completed and that it precisely matches the product ID and date of the original transaction. However, next time I run the app the whole things starts over! It's like the iTunes Store was never notified that the transaction completed, or refuses to acknowledge it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload