Testing iOS in-app purchases

I am working on Pic-a-POD for iOS and my plan is to have the basic app free, but with access to a single POD only. Unlocking the other PODs will be done via an in-app purchase.

For testing purposes, Apple asks you to create test user accounts inside your iTunes Connect account. You set them up for a specific regional app store and when you use them to buy, Apple’s servers respond correctly, but no money is involved.

You do need to have a unique email address for each test user, and Apple suggests that you create a user for each region where your app will sell. This was not a problem for me as I have my own server, so I was able to set up multiple email addresses to match. Otherwise I guess Gmail addresses or something similar would be the way to go.

The real difficulty is getting your iPhone or iPad to use the new login. As instructed, I went into Settings -> Store -> Apple ID and signed out of my standard account. But when I went into my app and tried to buy, the authentication dialog showed my standard email address as the Apple ID user name and only allowed me to enter the password, so that was no good.

Apple specifically warns not to sign in using Settings when using a test account or it will no longer be usable as a test account, so I didn’t try that.

After quite some searching and experimenting, I found a reliable sequence to make this work. Since I’m sure others will have the same issues, here is what to do to change to a test user account.

  • make sure iTunes is NOT set to start when the device is connected
  • if iTunes is running, shut it down
  • sign out in Settings -> Store -> Apple ID
  • delete the app from device
  • shut down the device completely
  • disconnect the device from computer
  • power on the device
  • after startup is complete, re-connect to computer
  • run app from Xcode

Quite a rigmarole, but at least I now have a method that works every time. When finished testing, don’t forget to go back to¬†Settings -> Store -> Apple ID. Sign out of your test account and sign in to your usual account.

2 thoughts on “Testing iOS in-app purchases

Leave a Reply

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