Search code examples
iosapp-storein-app-purchasestorekit

Sandbox: Is possible to simulate a failed or interrupted In App Purchase?


I have recently implemented In App Purchasing in my app. Good thing Apple has documented the whole process very well.

Using those docs, I'm finally able to test In App Purchasing through the Sandbox, which is a very convenient feature. I have successfully tested my app so that it reacts to whatever the StoreKit returns when I tap the buyButton.

Now here's my question. From the docs, it says that the Sandbox simulates the transaction process with no financial stuff. So I'm free to buy as much as I want (by the way, I'm buying consumables and only consumables). Also, the Sandbox will ALWAYS simulate a successful transaction, no matter what. So, is it possible to have the Sandbox simulate a failed transaction, and better yet, an interrupted transaction?

I want to do that to trap possible errors when those events happen (although I've read somewhere that StoreKit already handles that) and display them on the screen (at the very least), just to inform the user what's happening during the transaction process.

Thanks in advance.


Solution

  • An easy way to simulate lots of common networked transaction problems is to unplug the network cable from the back side of the wifi access point being used at various points in the process. You could try stuff like unplugging the wifi's WAN cable, then use alternate or cabled access to remove your IAP from availability in iTunes Connect, then re-enable wifi access.