Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Sandbox - Can't purchase a consumable item twice

Problem: I'm trying to test in app purchases with a sandbox account, but every time I try to purchase a consumable item twice, I get the following error message:

You've already purchased this In-App Purchase but it hasn't been downloaded. 
                         [Environment: Sandbox]

This only happens when using iOS < 6. I've read that this may be a sandbox-related issue. Does anyone know if there is any truth to that statement?

I'm sure that the following call is being made to complete the first transaction:

[[SKPaymentQueue defaultQueue] finishTransaction:transaction]

I've tried making this call as well to flush out the queue with no luck:

[[SKPaymentQueue defaultQueue]  restoreCompletedTransactions];

I'm also making sure that before testing the iAP, I'm logged out of the iTunes store. In addition, I've also checked that the build and version number are in the Summary pane of my Target in Xcode.

like image 477
user2125688 Avatar asked Mar 02 '13 02:03

user2125688


1 Answers

I had a similar situation that I would get this message and then crash if I tried to purchase it again. To me, it looks like this is just a message that finishTransaction hasn't completed (for whatever reason). According to my logs, it grants a SKTransactionStateFailed updated transaction, allowing me to resend the finishTransaction.

I then check in within my app that it has in fact downloaded the data/purchase BOOL/whatever and present a user interface if they need to download it again. Don't seem to have a problem with subsequent downloads.

To prevent the crashing, I included:

[[SKPaymentQueue defaultQueue] removeTransactionObserver:self];
like image 92
canuckpilot Avatar answered Oct 13 '22 12:10

canuckpilot