Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
557 views
in Technique[技术] by (71.8m points)

iphone - How to get Sqlite database file when application is running on device?

I am facing problem in accessing database file when I am running it on device. How can I get that file? There is no problem in accessing file when I am running application on simulator. Like when I am running application on simulator DB file is in :

/Users/Nitish/Library/Application Support/iPhone Simulator/4.3/Applications/1B787527-0608-4BC1-8022-DFDB3CC35F66/mysqlite.sqlite

Where will I find the DB file when application is running on device?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Reading all comments and answer, I think nobody actually answered simple question of the author:

How to access sqlite database file while runs on the actual device (it's not an issue in iPhone simulator as author indicated)

Here is what I do:

  1. (once!) Make sure all hidden files are visible on your Mac: In terminal window run: defaults write com.apple.Finder AppleShowAllFiles YES

  2. While in Xcode, open Organizer -> Devices, find your iPhone and from their find your application in Applications folder.

  3. At the bottom click Download and download the application to your desktop (anywhere)

  4. Open Finder, navigate to the downloaded file, right click on it and select Show Package Contents. The view will change to standard finder view with open files in that app.

  5. Go to the Documents folder, find your *.sqlite file, right click on it and choose Open With -> Other

  6. Select SQLite Database Browser (http://sqlitebrowser.sourceforge.net) and enjoy view of your database through database browser.

It takes less than a minute to run the whole process, once you do it once.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...