so i'm trying to use Core Data for the iPhone OS 3.0. i'm new to iPhone programming (and programming on the mac with tools like XCode).
anyway, i'm trying to use NSFetchedResultsController to fetch some data but my program crashes giving me a "EXC_BAD_INSTRUCTION". when i check the console there's a message saying "message class sent to freed object=0x<some address>"
so i guess my code is trying to use some object that has been released, but i cant figure out which object!!
the offending code is this:
and i cant for the life of me figure out what the hell is going on??
when i replace that last line with this one:
it works just fine!!
any ideas?? thanks!
anyway, i'm trying to use NSFetchedResultsController to fetch some data but my program crashes giving me a "EXC_BAD_INSTRUCTION". when i check the console there's a message saying "message class sent to freed object=0x<some address>"
so i guess my code is trying to use some object that has been released, but i cant figure out which object!!
the offending code is this:
Code:
NSManagedObjectContext* mob = ((MyAppDelegate*)[[UIApplication sharedApplication] delegate]).managedObjectContext;
NSEntityDescription* entityDesc = [NSEntityDescription entityForName:@"Record" inManagedObjectContext:mob];
[request setEntity:entityDesc];
//this is the line where the program crashes
NSFetchedResultsController* frc = [[NSFetchedResultsController alloc] initWithFetchRequest:request managedObjectContext:mob sectionNameKeyPath:nil cacheName:nil];
and i cant for the life of me figure out what the hell is going on??
when i replace that last line with this one:
Code:
NSError* error;
NSMutableArray* mutableArray = [[mob executeFetchRequest:request error:&error] mutableCopy];
it works just fine!!
any ideas?? thanks!