Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view data stored in Core Data?

I'm creating a Core Data model for my application. I would like to be able to look inside it to see what I have stored in there.

Is there an easier way than searching for the backing store (mine should be SQLite) and reading it from there? Doesn't seem very Apple-esque.

like image 712
Frank Avatar asked Feb 15 '10 18:02

Frank


People also ask

How can you retrieve data from Core Data?

You should load all your Objects from CoreData into an Array/Dict of NSManaged Objects. executeFetchRequest() returns an optional which is nil if the fetch request fails. If you forcefully cast to [Locations] then the app will crash in that case.

Where is Core Data saved?

The persistent store should be located in the AppData > Library > Application Support directory. In this example you should see a SQLite database with extension . sqlite. It is possible that you don't see the persistent store in the Application Support directory.


1 Answers

Once your app has run in the simulator and created the persistent store file, you can find the file in your app's Documents directory.

Your app data will be folder inside (~ is your home directory):

~/Library/Developer/CoreSimulator/<device>

In versions prior to XCode 6, the path was:

~/Library/Application Support/iPhone Simulator/User/Applications/

I sort by "Date Modified" to find the app that I just built.

For viewing a SQLite file, check out Base and/or Core Data Editor.

like image 196
gerry3 Avatar answered Sep 22 '22 04:09

gerry3