Skip navigation.
 
mlCore Data Managed Object Context Problem
FROM : Philip Bridson
DATE : Tue Feb 05 23:41:24 2008

Hi there,

I need to make my Managed Object Context that is in one file available to several other files. I have tried many tactics which include passing it in to a class as an argument to a function for example

NSManagedObjectContext *moc...    //Assume this exists

[someObject setManagedObjectContext:moc];

This works fine from the file that contains the original moc to a single separate class but if I do it to a second file it crashes and says EXC_BAD_ACCESS.

Also if I use the documented way from core data e.g

-(NSManagedObjectContext *)managedObjectContext
{
      return moc;
}

it still gives me a EXC_BAD_ACCESS if I use it on multiple files.

The only way I have found is if all my windows are in the same nib and I use an IBOutlet to where the moc is. But what if I don't want all my eggs in one basket? How do I do it. Any idea's would be grateful.

Many thanks.

Phil

Related mailsAuthorDate
No related mails found.