another one ive been at for hours. Im having a major problem getting my app to ‘see’ my Entity in my database…
I have created code in my appDelegate to set up Core Data. The first view I boot to can access this data (read / write) with no problems. If I then try to access the database from another viewController its as if it doesn’t exist.
I have all the correct @property’s set up in my viewController header files:
@property (strong, nonatomic) NSFetchedResultsController *fetchedResultsController;
@property (strong, nonatomic) NSManagedObjectContext *managedObjectContext;
I have also got each viewController to be:
NSFetchedResultsControllerDelegate
- I have imported the relevant header files in the .m files where I want to access the entity.
This is the error I get:
'+entityForName: could not locate an NSManagedObjectModel for entity name MyEntityName'
The confusing thing is that if I change the start up view from the appDelegate is has no problems seeing the Entity in whichever view controller I choose. It seems like it is ‘injecting’ it into the first one, but then thats it.
Im guessing I need to set up / alloc init a NSManagedObject and reference it back to my Entity, but I have no idea how to do this.
Any clues?
Thanks
So I guess what you need to do is pass the managedObjectContext like this