Answer: EXC_BAD_ACCESS exceptions usually happen when your code wants to use objects that have already been released. When the error is caught, the call stack is usually has gone on vacation. This is the probable reason of the silent exit and the jump to the main.m as the last resort of your debugger.
There is a well known NSZombieEnabled environment variable that, when it’s enabled, leaves a dummy object behind for every deallocated object. It lets us trace released objects while chasing an EXC_BAD_ACCESS exception. When NSZombieEnabled is set to YES, the class of all deallocated objects is dynamically changed to _NSZombie. The memory region will never free, so NSZombieEnabled should not be left in place otherwise you will spend hours trying to find memory leaks. Do not forget to set its value to NO when you are ready.
Where and how to set NSZombieEnabled to YES in Xcode 4?
1. Go to your project in Xcode 4 2. Environment variables can be set up in the Scheme editor (find Product -> Edit scheme… in menu bar):
UIImage *imageBackground;
}
@property (nonatomic, retain) UIImage *imageBackground;
...
@implementation myNavigationBar
@synthesize imageBackground;
...