How do you test a Mac App with iCloud? Or with in-App purchases? How can you test that your receipt validation code is working right, and so on?
Of course you can just build and run any project to test it the debug build. But before submitting an update, you should always test the exact build you submit to the App Store. And if you want to test in-app purchases on Mac, you need to get a receipt, which doesn’t happen when debugging.
Pre-Mavericks, you could export the installer from the archive, install the app and then run it to get a receipt using a test account. That no longer works—the build will fail to run.
I’ve been struggling with this problem since Mavericks, and ended up burning a DTS incident to figure out what to do. Fortunately, the solution is easy, and there’s even a tech note explaining how to do it:
- Choose Product > Archive in Xcode.
- In the Project Organizer, select the Archive and click Distribute
- Select the Export As option, and choose Application as the format
- On the next page, when prompted to sign the build, choose your Development certificate, NOT your Distribution certificate, and click Export.
That last point is the key point. You’re going to get a little warning icon when you select the Development certificate, but this is in fact the right procedure.
That will give you an application you can use for testing in app purchases (with an iTunes Connect test account) and will also allow you to test the exact App Store build to find any bugs you can’t reproduce in your debug build.