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.

Possible Errors:

  • 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

DebuggingAutorelease
http://www.cocoadev.com/index.pl?DebuggingAutorelease
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.

Debugging Techniques
http://www.cocoadev.com/index.pl?DebuggingTechniques

NSAssert() call to validate method parameters is to track and avoid passing nils set a breakpoint on objc_exception_throw.

Examples

Error occur:
NSMutableString *string; [string   appendWithFormat:@”foo”];
Fix:
NSMutableString *string = [[NSMutableString alloc] init];
[string appendWithFormat:@”foo”];

Error occur:
NSLog(@”Message %@-%@”);

Fix:
NSLog(@”SMessage %@-%@”, object1, object2);


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading Xcode Program received signal: “EXC_BAD_ACCESS” at Web Builders.

meta

%d bloggers like this: