We have come across an error which we can reproduce 100%, but before filing a bug report maybe someone here can see something that we may have overlooked. It only happens on iOS as far as we know, and we are testing with our sandbox test accounts as the app is not live yet.
Here is the chain of events to reproduce.
-
Open game, go to store.
-
Store loads products - this works fine.
-
Press one of our store buttons which calls store.purchase(theProduct)
-
Before the iTunes popup appears - background the app.
-
Fill in password/press ok on the iTunes popup.
-
Complete the purchase, get the “purchase successful” popup.
-
Kill the app (this may seem like an odd thing to do, but we were trying to simulate the app crashing at this point).
-
Open app - the following table data is received by store lib:
<Warning>:event.transaction.state: failed <Warning>:event.transaction.date: nil <Warning>:event.transaction.identifier: ABCDEFG-1234-5678-XXXX-1234567890AB <Warning>:event.transaction.productIdentifier: quiztix.mygame.consumable1 <Warning>:event.transaction.errorType: none <Warning>:event.transaction.errorString: nil
This is printed inside out IAP listener that is passed into store.init(). The store.finishTransaction function is called here, and we’ve printed a line underneath that to be sure that the code gets that far. However the transaction returned has a “failed” state, so I’m not sure if that transaction being passed into store.finishTransaction is causing this problem:
- Press the purchase button again.
- Get this error “This In-App purchase has already been bought. It will be restored for free”. However this does not trigger the listener function at all, so no data is passed from this purchase attempt, and store.finishTransaction() is not called.
It might seem like an unusual usage case, but as I mentioned earlier the reason for suspending/killing during the purchase process was to simulate the app crashing for unrelated reasons. As it stands the user will have made a purchase and not received the item they paid for, and cannot even make the purchase in future if they wanted to.
Is there something we’ve missed because our deadline to submit is in the next 18 hours and it would be a massive help if someone can spot something.