Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IPhone core data simulator

I've created an app that uses core data. Is there a way to view the sqlite db on the simulator? A tool perhaps that allows to query the sqlite db on the simulator? Like a data browser?

Is there a way to browse the iphone simulator to the sqlite db location?

like image 430
pdiddy Avatar asked Oct 26 '10 13:10

pdiddy


People also ask

How can I view core data in iOS?

Open Xcode and create a new project by choosing the Single View App template form the iOS > Application section. Name the project Notes and check Use Core Data at the bottom. Open AppDelegate.

What is core data on iPhone?

Core Data is a framework that you use to manage the model layer objects in your application. It provides generalized and automated solutions to common tasks associated with object life cycle and object graph management, including persistence.

Should I use Core Data iOS?

The next time you need to store data, you should have a better idea of your options. Core Data is unnecessary for random pieces of unrelated data, but it's a perfect fit for a large, relational data set. The defaults system is ideal for small, random pieces of unrelated data, such as settings or the user's preferences.

Do I need Xcode for iOS simulator?

Launching the Simulator, though, always requires opening Xcode and going to Developer Tools. Because the Simulator. app is embedded within the Xcode app bundle, apps like LaunchBar won't find it to index it. LaunchBar, which is my launcher of choice, also ignores aliases, so dragging Simulator.


2 Answers

With Xcode 6, the simulator base directory can be found here:

~/Library/Developer/CoreSimulator/Devices/<device-id>/data/Containers/Data/Application

Then, the database itself can be found in the documents directory:

<app-id>/Documents/<name>.sqlite

The database can be accessed using sqlite3 on the command line.

like image 141
Ja͢ck Avatar answered Oct 16 '22 10:10

Ja͢ck


Xcode 5

I just downloaded a trial of Base and was able to point it at the .sql database from the simulator via:

/Macintosh HD/Users/"username"/Library/Application Support/iPhone Simulator/"current iOS development version"/Applications/

The folder names for the applications are unreadable, but if you click on the folder you should be able to see the contents with familiar names.

Xcode 6+

This was changed in Xcode 6, and now is located at ~/Library/Developer/CoreSimulator/Devices/<device-id>/data/Containers/Data/Appl‌​action where the database itself can be found within the documents directory <app-id>/Documents/<name>.sqlite

like image 22
joebonniwell Avatar answered Oct 16 '22 09:10

joebonniwell