joan joan - 22 days ago 7
Objective-C Question

Location of Sqlite file location of CoreData iOS App

I am developing an iOS application with Objective-C and CoreData. Where can I locate the sqlite file generated on the iOS device?

Answer

IF the store uses a persisted file, you can even get it in code

//get you context, the coordinator, attached stores
NSManagedObjectContext *moc = [MyDataStore sharedDataStore].mainManagedObjectContext; //however you get the MOC
NSPersistentStoreCoordinator *coordinator = moc.persistentStoreCoordinator;
NSArray<NSPersistentStore*> *stores = coordinator.persistentStores;

//log it
for (NSPersistentStore *store in stores) {
    NSLog(@"%@", store.URL);
}