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?
开发者_Python百科Is there a way to browse the iphone simulator to the sqlite db location?
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.
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/Applaction
where the database itself can be found within the documents directory <app-id>/Documents/<name>.sqlite
Try Lita, free and quite good.
If you have the free sqlite3
installed, you can do so at the command line by doing:
/Users/<user>/Library/Application\ Support/iPhone\ Simulator/<sim_version>/Applications/<apphash>/Documents/<yourfile>
Easiest way to see which hash you should peek in:
ls -lt /Users/<user>/Library/Application\ Support/iPhone\ Simulator/<sim_version>/Applications/
You can run .tables
at the prompt to see what tables are there, and .schema <tablename>
to check out its columns.
i´m quite happy with SQLite Manger for Firefox. Free AddOn.
This is a quite an old post, however I was looking for something else and I landed here, my 2 cents:
In reply to WINSergey: (1) The easiest way to recover your device ID and the entire path is to print:
NSLog(@"app dir: %@",[[[NSFileManager defaultManager]
URLsForDirectory:NSDocumentDirectory
inDomains:NSUserDomainMask] lastObject]);
Then you'll see the output on the Debugging area or opening the System Log from the simulator.
(2) Also, to know the Device ID from the simulator: XCode > WIndow > Devices > > it shows the Identifier on the right hand side.
I'm also using SQLiteStudio, it is Open Source and works well.
精彩评论