1
votes

In my application's documents folder, I do not find my SQLite database

Library/Application Support/iPhone Simulator/6.1/"random app id"/Documents/

^This folder is empty

MagicalRecord seems to be working, I just have no idea how to find the database.

I use the following to set up Magical Record

[MagicalRecord setupAutoMigratingCoreDataStack];

So where does MagicalRecord store its database?

4

4 Answers

4
votes

MagicalRecord stores, by default, all data stores in the following location:

{App Folder}/Library/Application Support/{App Name from Info.plist}/{storeName.sqlite}

This is easily accessible from the simulator as well as documents.

3
votes

You can log your SQlite file location using the following NSPersistentStore MR addition :

[NSPersistentStore MR_urlForStoreName:[MagicalRecord defaultStoreName]]
0
votes

If you know the name of the sqlite file then just do a search in OSX for that file to find the directory. Otherwise the file was never created.

Make sure you are setting up the CoreData stack correctly as per the documents.

+ (void) setupCoreDataStackWithAutoMigratingSqliteStoreNamed:(NSString *)storeName;
0
votes

Swift + Xcode 7 + simulator 9.0

Please go to your AppDelegate.swift

change

MagicalRecord.setupCoreDataStackWithStoreNamed("yourDBName.sqlite")

to

MagicalRecord.setupCoreDataStackWithAutoMigratingSqliteStoreNamed("yourDBName.sqlite")

Now you can locate the yourDBName.sqlite at /Users/userName/Library/Developer/CoreSimulator/Devices/"random app id"/data/Containers/Data/Application/"random app id"/Library/Application Support/ProjectName

There is a useful tool: simPHolders2 (http://simpholders.com) simPHolders easy to access all application folders