joan joan - 1 year ago 112
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 Source

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);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download