I'm trying to update an old project thats been updated since 2012. Obj-C and Core Data isn't my core competency, so I was hoping to use Magical Record. I've installed it via CocoaPods and as best I can tell it's installed.
The problem: I've got it setit up as per the docs, but cant return an entity using MR_findAll but I can return a list of all managed objects, so it seems to be working sort of.
I've commented out all the older native CoreData lines.
My model is called "PetStore.xcdatamodeld" which isnt the same as my App.
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
[MagicalRecord setLoggingLevel:MagicalRecordLoggingLevelDebug];
[MagicalRecord setupCoreDataStackWithStoreNamed:@"PetStore"];
Then in my view controller this works and return a list of managedObjects:
NSArray *allEntities = [[NSManagedObjectModel
MR_defaultManagedObjectModel] entities];
for (NSManagedObject *mo in allEntities) {
NSLog(@"mo %@", mo);
}
But I cant use MR methods to fetch entities. This doesnt work:
NSArray *pets = [Pet MR_findAll];
NSLog(@"pet %@", pets.count);
That just logs:
pet (null)
But I can see I have a managed object and entity with that name:
[2430:365392] mo (<NSEntityDescription: 0x604000148da0>) name Pet, managedObjectClassName Pet, renamingIdentifier Pet
What am I missing? I'm going around in circles. I looked at sample projects and they work just fine.
Help!
TIA.