30

How to view the data which is present in the sqlite file in an application running in iphone , like we use mysql work bench to view the contents of the database

Mohamed Jaleel Nazir
  • 5,776
  • 3
  • 34
  • 48
pradeep
  • 3,005
  • 12
  • 42
  • 65
  • 1
    [The Library folder was hidden - this answer helped me][1] [1]: http://stackoverflow.com/questions/11761695/where-does-the-iphone-simulator-save-the-sqllite-database – Bob Mar 22 '14 at 08:40
  • Use command `find /Users//Library/Developer/CoreSimulator/Devices/ -name "*.db" -printf "%T+\t%p\n" | sort` to find the latest modified db file – user10375 Oct 10 '19 at 00:27

8 Answers8

83

If you want to view your database when running on Simulator it is located at the following location

user/Library/Application Support/iPhone Simulator/version of SDK(4.2eg)/Applications/4AF938D6-E981-4971-A588-3424B64E7EE7(eg)/Documents/yourdatabase.sqlite

If you want to view the database in your device then you can use a software like iExplorer.

Cheers

Edit : The location of sqlite file has changed.

It currently resides in :

/User/Library/Application Support/iPhone Simulator/version of SDK(eg-7.0)/Applications/4AF938D6-E981-4971-A588-3424B64E7EE7(eg)/Library/Application Support/app_name/yourdatabase.sqlite

Edit : The location has changed again. It now resides in:

/User/Library/Developer/CoreSimulator/Devices/789A1317-6C55-4615-A72E-65C824D8C6B9(eg)/data/Containers/Data/Application/0470F5FC-0043-46B7-A21C-A436A56ED714(eg)/Documents/yourdatabase.extension
Manishh
  • 1,444
  • 13
  • 23
Aditya
  • 4,414
  • 5
  • 29
  • 40
7

If you want to see data base while app is running in simulator

  1. Open finder
  2. open Go in toolbar
  3. Then Press and hold command+option you can see Library option

then process like this

Library/Developer/CoreSimulator/Devices/8FA9F307-45DC-48EC-89ED-E4BDC34CB628/data/Containers/Data/Application/B6105584-49BF-4C0C-BC72-C97FA9B1C194/Documents/database.db
Manishh
  • 1,444
  • 13
  • 23
Mounika reddy
  • 81
  • 1
  • 4
7

The Firefox extension SQLite Manager is good and free. Another good, free Mac option is SQLite Database Browser.

Matthew Frederick
  • 22,245
  • 10
  • 71
  • 97
3

Grabbing a database in live mode (meaning an apps-live-database on an iphone) you can use the iExplorer for downloading the .sqlite file to your computer and explore it with e.g. MesaSQLite!

Thank you so much for pointing me into the right direction here!

Community
  • 1
  • 1
andreas-supersmart
  • 4,114
  • 2
  • 18
  • 13
3

These locations depend on the device you're using in the simulator, so it makes no sense to copy a specific folder as the answer...

The more general answer about how to figure out the path to the actual database file:

  1. On the dock, right click on Finder, select Go To Folder
  2. Paste in the following, and click Go: ~/Library/Developer/CoreSimulator/Devices
  3. On the top right corner of the Finder window search for the database name you are looking for, then make sure the Search location is set to "Devices" folder, not the whole "This Mac".
  4. The db file will show up and if you select it, it will give you the full path! To browse the database content I use this tool: sqlitebrowser
balazs630
  • 3,421
  • 29
  • 46
2

If you're comfortable using Xcode plugins, NCSimulatorPlugin makes it trivial to jump right to your app from Xcode.

enter image description here

Instead of choosing Go To Documents as shown above, choose Go To Application.

enter image description here

Ctrl-click on the app and choose Show Package Contents.

enter image description here

Done!

clozach
  • 5,118
  • 5
  • 41
  • 54
0

The solutions involving simulator do work but sometimes you needed to explore the database on a physical device.

If you want to view your sqlite database when running on a device connected to your Mac you'll first need to mount the application files on your mac. You can use iExplorer for that. There is a free demo I used for testing but paid $40 in end: iexplorer website

enter image description here

Once you mount the apps files you can explore the database using DB browser for sqlite: DB browser for sqlite website. Its not as polished as mysql workbench but its free and gets the job done.

enter image description here

mrjrdnthms
  • 1,549
  • 4
  • 24
  • 35
0

The location of sqlite file (Simulator):

/Users/myUser/Library/Developer/CoreSimulator/Devices/032D9DFB-FBD4-4204-B137-945F1A02FDED(eg)/data/Containers/Data/Application/C10BDAF7-25E2-42CC-A1BE-C5CC04C7567D(eg)**/Library/LocalDatabase**

I use the DB Browser for SQLite to view the database: http://sqlitebrowser.org/

piet.t
  • 11,718
  • 21
  • 43
  • 52