When creating a new project (universal iPhone/iPad) using Core Data, there's the usual appDelegate which creates the ManagedObject Model/Context etc., then there are the two subclasses of the appDelegate (one for each device). I can't seem to call the moc from the subclasses (using [super managedObjectContext]). Could someone enlighten me as to what I'm doing wrong? Something to do with initializing the common appDelegate perhaps? Billy
A:
You should be able to use the managedObjectContext, managedObjectModel, and persistentStoreCoordinator instances from the subclasses if you access them as properties (since the property definitions are exposed in the superclass’ header):
self.managedObjectContext;
self.managedObjectModel
self.persistentStoreCoordinator
Raphael Schweikert
2010-07-28 22:22:35
OK, I tried that (again) but it doesn't work. If I do an NSLog asking for both self and super descriptions it comes back with the "appDelegate_iPhone" both times (instead of "appDelegate_shared" that I would expect for super). It's as if the subclass doesn't know about the superclass (I also imported it).
BillySangster
2010-07-28 23:38:39
Found what I did wrong. There was a typo in my Managed Object Model (from 24 hours ago!) Thanks for the answer.
BillySangster
2010-07-29 09:54:35