How to Test Your Mac App Store App

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:

  1. Choose Product > Archive in Xcode.
  2. In the Project Organizer, select the Archive and click Distribute
  3. Select the Export As option, and choose Application as the format
  4. 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.

iOS 8 Extensions: Sharing Code with an Embedded Framework

Note: Due to the NDA, this tutorial won’t include any screenshots from Xcode 6. When iOS 8 is released, I will update the tutorial with screenshots.

Extensions were one of the more dramatic new things introduced at WWDC 2014. They allow all kinds of convenient ways to extend the power of your app beyond the app itself.

This tutorial will walk you through making a today extension for iOS 8 (commonly called a widget). Widgets display in notification center, and allow people to quickly access to bits of information or perform simple actions without having to launch your app.

Although this tutorial specifically focuses on today extensions, much of what we will cover  applies to other extensions too, including sharing code & data.

Before you begin, download the source code to super simple sample app Word of the Day here. Word of the Day as you would expect, displays the word of the day from Wordsmith.org. It wouldn’t get many downloads in the App Store, but it does the job.

This is a finished project, with a widget (today extension), an embedded framework we are using to share code, and data sharing with a shared container.

Continue reading