Xcode Program received signal: “EXC_BAD_ACCESS”
December 25, 2009 § Leave a comment
Program received signal: “EXC_BAD_ACCESS”
This error occurs in device not simulator.
- access protected or non-existent memory space as result of a bad pointer
- access memory without alloc init
- access memory after released object
- remove the [object release] only if you don’t use alloc/copy/retain
- trying to access release objects
- illegal memory access
This show you how to use Cocoa’s NSZombie debugging class and the command line “malloc_history” tool to find exactly what released object has been accessed in you code.
Running Instruments and checking for leaks will not help troubleshoot EXEC_BAD_ACCESS.
NSAssert() call to validate method parameters is to track and avoid passing nils set a breakpoint on objc_exception_throw.
NSMutableString *string; [string appendWithFormat:@”foo”];
NSMutableString *string = [[NSMutableString alloc] init];
NSLog(@”SMessage %@-%@”, object1, object2);