Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I access SQLite database instance on iPhone?

Tags:

sqlite

ios

iphone

I'm developing an iPhone app that uses the built-in SQLite database. I'm trying to view and open the database via the sqlite3 command line tool so I can execute arbitrary SQL against it.

When I run my app in the simulator, the .sqlite file it creates is located at ~/Library/Application Support/iPhone Simulator/User/Applications/.

How can I see that file on the physical iPhone?

like image 933
Keith Fitzgerald Avatar asked Oct 01 '08 21:10

Keith Fitzgerald


People also ask

How do I access SQLite database on Iphone?

Step 1 − Open Xcode -→ Single View Application -→ Let's name is DBSqlite. Step 2 − Let's develop our UI, Open Main. storyboard and add one text field and two buttons as shown below. Step 3 − Create @IBAction for both the buttons and @IBOutlet for text field and name them btnInsert, btnShowData and name respectively.

Does SQLite work on Iphone?

The database that can be used by apps in iOS (and also used by iOS) is called SQLite, and it's a relational database. It is contained in a C-library that is embedded to the app that is about to use it.

Where is SQLite database stored iOS?

-Navigate to /Users/jk/Library/Developer/CoreSimulator/Devices/ and select the simulator file that matches the ID you found. -In the finder search, search for The current Model Version name.


2 Answers

Instructions for Xcode 6.0.1

  1. Xcode > Open > YourProject
  2. Xcode > Product > Run
  3. Xcode > Window > Devices
  4. (Column 1 - select) Devices > YourDeviceName
  5. (Column 2 - select) Installed Apps > YourAppName
  6. (Column 2 - select) Cog under 'Installed Apps' list
  7. (Pop-Up - select) Download Container...
  8. Save to location
  9. Right click on 'YourAppName.xcappdata'
  10. Select 'Show Package Contents'
  11. AppData > Documents > YourDatabase.sqlite

enter image description here

like image 142
Tr0yJ Avatar answered Oct 05 '22 18:10

Tr0yJ


In Xcode select window->organizer and expand the node next to your application in the applications section on your phone. Select the black downward pointing arrow next to application data and save the file anywhere on your desktop. Your sqlite database should be in there somewhere.

As for how to go about getting it back on the phone once your done i have no clue.

like image 21
Lounges Avatar answered Oct 05 '22 18:10

Lounges