IPhone core data simulator

纵然是瞬间 提交于 2019-12-18 21:32:43

问题


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?


回答1:


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




回答2:


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.




回答3:


Try Lita, free and quite good.




回答4:


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.




回答5:


i´m quite happy with SQLite Manger for Firefox. Free AddOn.




回答6:


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.



来源:https://stackoverflow.com/questions/4023954/iphone-core-data-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!