The code you provided is in order and should not be called EXC_BAD_ACCESS, however you are mentioning an accident with NSLog. A common mistake to make with NSLogis to provide a C style string for the format string, not NSString. The following are the errors:
int i = 4;
NSLog("%d", i); // oh no!
Instead, you need to make sure the NSLogfirst argument NSString, for example:
int i = 4;
NSLog(@"%d", i); // yay!
source
share