Im exploring user migration of the main database, for which I need to run a test in an existing repository to find out if it is compatible with the currently loaded mom. And for this I need to get metadata from the repository.
So, I do this in the AppDelegate class:
NSFileManager *fileManager = [NSFileManager defaultManager]; NSString *applicationSupportDirectory = [self applicationSupportDirectory]; NSURL *url = [NSURL fileURLWithPath: [applicationSupportDirectory stringByAppendingPathComponent: @"sharedPersistMainStore.sqlite"]]; NSDictionary *storeMetadata = [NSPersistentStore metadataForPersistentStoreWithURL:url error:&error];
But I get this error:
metadataForPersistentStoreWithURL: error: cannot be sent to an abstract object of the NSPersistentStore class: create a specific instance!
Theyre telling me to use this as an instance method. But the API definitely lists it as a class method.
Still strange, calling this (deprecated) method works as expected:
NSDictionary *storeMetadata = [NSPersistentStoreCoordinator metadataForPersistentStoreWithURL:url error:&error];
Except for the warning that this is an obsolete method.
Any ideas on what's going on?
source share