Philip Sheard
Philip Sheard

Reputation: 5825

How can I make an SQLite database within an iPhone app available to the desktop?

My Android app stores its SQLite database on the SD card, so that when the phone is connected to a PC my desktop application can access it using an ODBC driver. Is a similar technique possible on the iPhone?

I know that iPhones do not have SD cards.

Upvotes: 1

Views: 404

Answers (4)

Stephen Joy
Stephen Joy

Reputation: 328

I use iTunes file sharing to access sqlite DBs on both the iPhone and iMac; iTunes moves the data. Enabled in the plist

Upvotes: 2

Goles
Goles

Reputation: 11799

As it has been said, it can't be done.

However what you could do is to embed a small Web Server into your App, and let the users to download the DB ( or even visualize it ), via WiFi on their homes/work. This approach would work for Windows/Mac/Linux users, and several apps are already doing it this way.

Good luck!

Upvotes: 2

Tommy
Tommy

Reputation: 100622

SQLite is present in the iPhone SDK, but there's no way to flag a file stored by your application as being visible to the file system when you plug your iPhone into the computer. As stated already by Chris Long, Apple's answer to this criticism is iCloud, which allows you to do synchronisation between arbitrarily many devices without cables, but that isn't available yet. The iOS 5 beta is available to registered developers and is publicly known to function with iCloud, so you could start developing now.

More painful temporary alternatives are to email the database out (there's a supplied way to do in-app email) or to expect your user to drag and drop the thing out of iTunes.

Upvotes: 1

Chris Long
Chris Long

Reputation: 3074

Not built-in, unfortunately. You'll have to roll your own Wi-Fi syncing system. You could use iCloud when it comes out in the fall, but that only works on Macs for now.

Upvotes: 1

Related Questions