Open sqlite database file inside iphone simulator?
Update: I made a tool to automate this
Both for Android and iOS, it's available here
Old question, but Apple seem to keep change the logic...
On macOs Sierra you can find the database location by issuing the following commands (the simulator must run during the process!)
ps aux | grep 'CoreSimulator/Devices'
The result should list the path to the simulator, for example:
/Users/user1/Library/Developer/CoreSimulator/Devices/25C1F5DA-E528-4BC2-B684-A92D382553AC/data/var/run/launchd_bootstrap.plist
Navigate to the now found simulator folder:
cd /Users/user1/Library/Developer/CoreSimulator/Devices/25C1F5DA-E528-4BC2-B684-A92D382553AC/Data/Application/
This folder contains all the simulator applications
From here if you know the database name, just find it, like so:
find ./ -type f -name 'my_db.db’
And viola! You have the database path :)
Since IOS 8 they put it in a different folder:
Library/Developer/CoreSimulator/Devices/(numbers and letters)/data/Containers/Data/Application/(numbers and letters)/Documents/
Check this answer for more info
If you want to view the database that you have created,
Open finder -> press SHIFT + Command + G -> "~/Library/Application Support/iPhone Simulator" then go.
Open 5.0 (as per your version of simulator)-> Application-> select the pgm folder
-> Documents
Then you can see the database