I am trying something very trivial here, but the program is terminating with a “EXC_BAD_ACCESS” in the NSLog. I am attempting to populate a mutable array with several dictionaries like this:
NSMutableArray *_recipientsMutArray = [[NSMutableArray alloc] init];
NSDictionary *r1 = [[NSDictionary alloc] initWithObjectsAndKeys: @"firsValue", @"firstKey", @"secondValue", @"secondKey", nil];
[_recipientsMutArray addObject:r1];
[r1 release];
Why?
The code that you have provided is fine, and shouldn’t cause
EXC_BAD_ACCESS, however you mention a crash withNSLog. A common mistake to make withNSLogis to provide a C-style string for the format string, rather than anNSString. The following will cause errors:Instead, you need to ensure that
NSLog‘s first argument is anNSString, like this: