问题
My friend and I are developing an app for the Mac app store. We submitted it to the app store but Apple rejected it on the basis of a bug we'd never experienced before ourselves. We had a hard time reproducing the error, but after quite some time debugging we found out that the bug only appears in an archived product.
The symptom of the bug is that some of the buttons in our app suddenly stop responding after using the app for a random amount of time. The only time we see this problem is in an archived app, so trying to find out what causes the problem is difficult.
What is actually happening when we archive our app? How does it differ from a build running directly in Xcode? Have anyone of you experienced a similar problem?
回答1:
What you have found is a heisenbug.
When you build your code for debugging, the compiler does not optimize your final build product. When you archive your application, the compiler will optimize the final product to make it run faster and take less memory. Your bug only shows up when you have optimized code.
You could be experiencing a deadlock or some other race condition that isn't present in the debug version of your application. You could build and run against your release configuration of your target and see if you can identify where it might be occurring.
Without seeing the code, however, SO won't be much help to you. Good Luck!
来源:https://stackoverflow.com/questions/9337511/bug-that-only-appears-in-archived-mac-os-x-product