EXC_BAD_ACCESS on NSError

The following code kept giving me EXC_BAD_ACCESS,


NSError* error;
 NSMutableArray* configurationArray = [[mManagedObjectContext executeFetchRequest:request error:&error] mutableCopy];
 if (error != nil) {
 NSLog(@"Error: %@", error);
 }

Apple has a list of suggestions on what might be causing this. However my problem was different, which was that I wasn’t initializing error pointer as such,


NSError* error = nil;

I miss Java :(

Posted in: Objective C, iPhone



addLeave a comment