Path to Core Data database with Magical Record

707 Views Asked by At

When i use to work with core data i often use that code to show me path to .sqlite database:

NSLog(@"%@ path-core",[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory  inDomains:NSUserDomainMask] lastObject]);

However, when i add Magical Record to my project, i used this instead:

NSLog(@"magical record path to SQLite base %@", [NSPersistentStore MR_defaultLocalStoreUrl]);

Which print path:

/Users/Necrosoft/Library/Developer/CoreSimulator/Devices/68A05D98-7949-4F90-BFB9-9C8A368F411B/data/Containers/Data/Application/7EC45D6A-B20E-4EC2-B657-1425F714518F/Library/Application%20Support/MyApp/CoreDataStore.sqlite

But i cant find CoreDataStore.sqlite. When i try "go to" with finder, i simply find an empty folder. But i guess there is actually .sqlite db stored in here. So how can i access it?

UPDATE: In Application Support folder there is actual 4 items, but i see only 3, 1 missing (hiding) is the one i need. How to get it?

enter image description here

1

There are 1 best solutions below

7
On

The ultimate goal for you is finding CoreDataStore.sqlite file.

open your terminal and type find ~ -name 'CoreDataStore.sqlite' and hit enter.

Ashoks-MacBook-Pro:Desktop Ashok$ find ~ -name 'CoreDataStore.sqlite'
/Users/Ashok/Desktop/CoreDataStore.sqlite

From above output you can clearly see the path of your sqlite db

I hope it helps:-)