Technical Q&A QA1778

How to reproduce bugs reported against Mac App Store submissions

Q:  I have reports of a bug in an OS X app I submitted to the Mac App Store, but I can't reproduce it with Xcode. How can I build my app so that it matches the Mac App Store version and reproduces the issue?

A: To reproduce a bug that Mac App Review or your users are seeing, you need to be sure that you are testing the exact build of the app that you submitted to the Mac App Store, in a minimally-privileged environment.

Test with a Guest Account

The most common reason for an app to work in your test environment but fail in Mac App Review or on a user's system is your test environment giving the app more privileges or including optional system components. The simplest way to rule this out is to test your app on a Guest account, ideally on a fresh install of the OS indicated in any crash or bug reports.

Test the Exact Build You Release

If there are bugs or undefined behavior in your code, compiler optimizations may cause the app you submitted to the Mac App Store to behave differently than any test builds made with different build settings.

Using Xcode's Archive feature, you can be sure you are testing the exact same build of your app that you plan to publish to the Mac App Store.

Archive Build Workflow

To create an Archived build that you can both test and submit:

1) In Xcode choose "Archive" from the "Product" menu to archive a build of your app. You can find the archive in the Archives tab in the Organizer window.

If you have trouble with this step, follow the directions in Troubleshooting application archiving in Xcode.

2) Deploy the build by selecting it in the Organizer window and pressing "Distribute…"; then select "Export As" and "Application". Choose a development signing identity, and save in appropriate location.

3) Run the app on a Guest account, ideally on a fresh install of the OS indicated in any crash or bug reports.

If you have problems installing a provisioning profile on your test system so you can run your test app, try the trouble shooting information in QA1759: Installing Production Provisioning Profiles.

For more information about working with archived builds, see the Distributing Applications section of the "Xcode 4 User Guide".

Next Steps

Once you can reproduce a problem, you will need to debug it. After launching your archived build, you can use Xcode's debugger on it by choosing "Attach to Process" from the Product menu. If a problem only reproduces in an optimized build, you may find that Xcode's debugger sometimes behaves oddly. This is because compiler optimizations make it difficult to translate back from machine code to a line number or variable name in source code. Do not be afraid to fall back on "caveman debugging" by using NSLog or printf if you are unsure what a value really is. For more information on writing rich NSLog statements, see Improved Logging in Objective-C.

For more information on debugging at the assembly level, see Mac OS X Debugging Magic.

If you are still unable to reproduce a crash, follow the steps in How to Match a Crash Report to a Build to verify that you are testing the build that exhibited the crash.

Document Revision History


New document that describes how to build and test your OS X app in order to reproduce issues only seen after submission to the Mac App Store