简体   繁体   English

如何使 iPhone 应用程序中的 SQLite 数据库可用于桌面?

[英]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.我的 Android 应用程序将其 SQLite 数据库存储在 SD 卡上,因此当手机连接到 PC 时,我的桌面应用程序可以使用 ODBC 驱动程序访问它。 Is a similar technique possible on the iPhone? iPhone上是否可以使用类似的技术?

I know that iPhones do not have SD cards.我知道 iPhone 没有 SD 卡。

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.但是,您可以做的是在您的应用程序中嵌入一个小型 Web 服务器,并让用户通过家庭/工作中的 WiFi 下载数据库(甚至可视化它)。 This approach would work for Windows/Mac/Linux users, and several apps are already doing it this way.这种方法适用于 Windows/Mac/Linux 用户,并且一些应用程序已经采用这种方式。

Good luck!祝你好运!

I use iTunes file sharing to access sqlite DBs on both the iPhone and iMac;我使用 iTunes 文件共享来访问 iPhone 和 iMac 上的 sqlite 数据库; iTunes moves the data. iTunes 移动数据。 Enabled in the plist在 plist 中启用

Not built-in, unfortunately.不幸的是,不是内置的。 You'll have to roll your own Wi-Fi syncing system.您必须推出自己的 Wi-Fi 同步系统。 You could use iCloud when it comes out in the fall, but that only works on Macs for now.您可以在秋季推出 iCloud 时使用它,但目前仅适用于 Mac。

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. SQLite 存在于 iPhone SDK 中,但是当您将 iPhone 插入计算机时,无法将应用程序存储的文件标记为对文件系统可见。 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.正如 Chris Long 已经说过的,Apple 对这一批评的回答是 iCloud,它允许您在任意多个设备之间进行同步,而无需电缆,但目前尚不可用。 The iOS 5 beta is available to registered developers and is publicly known to function with iCloud, so you could start developing now. iOS 5 beta 可供注册开发人员使用,并且通过 iCloud 为 function 公开,因此您现在可以开始开发。

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.更痛苦的临时替代方案是 email 数据库输出(有提供的方法来做应用程序内电子邮件)或期望您的用户将内容拖放到 iTunes 中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM