Testing in-app purchases in iOS 4.3 sandbox

In-app purchases have always been a bit painful to test. But recently (with iOS 4.0+), I’ve had a terrible time trying to get my iPhone to use the sandbox for testing. The problem is it often thinks it’s in the production environment *even* if you enter the in-app purchase test user (the symptom of this is when you are asked to confirm all sorts of details like the credit card number for the test user… that’s bad!).

I also had a problem where even after I had signed out of my AppleID on the iPhone it would still pop up with that AppleID asking for the password.

Here’s how I fixed it. Doing these steps seem to finally get it to use the sandbox (it’s possible some may be unnecessary – but when I do them all, it works):

  1. Sign out of your account on the iPhone in Settings -> Store
  2. Delete your test app
  3. Power the iPhone off and on again
  4. Close iTunes on your computer
  5. Run the app again from XCode


9 comments on “Testing in-app purchases in iOS 4.3 sandbox

  1. Dear Sir or Madam: (Can’t find your name on your blog.) Thanks so much for posting this. I was completely log-jammed! I had only one difference. I had to sign out of my store account after rebooting because it was automatically signing me back in.

  2. Hi David,

    You’re welcome. I was tearing my hair out about this problem a while ago, I managed to fix it but foolishly didn’t document it, so I went through it all again the other day. Interestingly, this was a lot easier in earlier iOS versions, but in 4.3 you really have to do all those steps to avoid this problem it seems.

    I too find that it will automatically sign me in, it seemed this happened when I plugged in the device and iTunes loaded.

    One work around for the automatic sign-in problem (which I guess is what you found) is at step #3 where you power it off, unplug the device –> power it on -> manually sign in to the test account in Settings -> then reconnect the USB cable.

    I think it’s best that iTunes *never* opens (it’s entirely not needed for dev and only seems to cause problems). So kill it when it does, and maybe tick the option to stop iTunes from booting automatically when you connect the device.


  3. Will,

    Than you for this article, it helped out a lot. I was going insane trying to sign into my iPad with a Test User account because it wanted a real credit card. And even a real credit card wouldn’t register. After going through your steps my in app purchase testing works like a charm.

  4. Hey, this was a ton of help. I also had to sign out of my account after re-starting my iPad 2. But seems doing all that finally kicked my device back into dev mode and I was able to test my IAP.


  5. Hello Guys,

    I have implemented the in-app purchase code in xcode 4.1 but the storekit delegate functions are never called and also it is not giving any error. Please help me. I test the app on iPad 1 with iOS 3.1

  6. “manually sign in to the test account in Settings ” I don’t think this is correct, as it goes against Apple’s instructions.

    All relevant advice I have read says you should only sign in to the test account when YOUR APP prompts, not through Settings, or you may render the test account unusable.

  7. Thanks for your advice Peter. I didn’t find the official docs all that useful for this problem – the steps above are the ones that work for me. YMMV :)

  8. Thanks for the info! I’ve found that if you use a non-existant email address for your iTunes Connect test user everything works ok. However, if you use a real email address and then confirm the account, as it seems you should, the issues with wanting a credit card and account info start.

Leave a Reply

Your email address will not be published. Required fields are marked *