I have an app that uses an SQLite database. With the advent of iCloud on the rise I'm trying to figure out a good architecture for syncing data between devices. So lets say my app runs on an iPhone, an iPad, and a Mac. How can I keep data in my DB up-to-date on all devices?
我有一个使用SQLite数据库的应用。随着iCloud的出现,我正试图找到一种好的架构,以便在设备之间同步数据。我的应用程序运行在iPhone、iPad和Mac上,我怎么能在所有设备上保持数据库中最新的数据呢?
My first thought was, I can put the database in the cloud and send transactions. But the device may not always been online and the users need their content at anytime, so that wont work. My other thought was to continue using the local db, and then when a connection is made, to send the cached data to the central db. The problem is I have no ideal where to even begin on something like that. How would I know which data has been sent and not sent, which data to actually send when a connection is made, etc.
我的第一个想法是,我可以将数据库放到云中并发送事务。但这款设备可能并不总是在线的,用户随时都需要他们的内容,所以这是行不通的。我的另一个想法是继续使用本地db,然后当建立连接时,将缓存的数据发送到*db。问题是我没有理想的起点,甚至从这样的事情开始。我如何知道哪些数据已经发送而没有发送,在建立连接时要发送哪些数据,等等。
So this is my question (we don't have to get into iCloud specifics), using an SQLite database and iCloud (or any storage medium), how can I sync data between multiple devices, but still have the most recent data stored locally on the device?
这就是我的问题(我们不需要了解iCloud的细节),使用SQLite数据库和iCloud(或任何存储介质),我如何在多个设备之间同步数据,但仍然有最新的数据存储在设备上?
1 个解决方案
#1
3
You might want to checkout Couchbase Mobile. This would help with the synchronization you are looking for.
您可能想要签出Couchbase Mobile。这将有助于实现您正在寻找的同步。
If you have a significant investment into CoreData, then you may want to look at writing your own NSIncrementalStore to support writing data to and from a key value store.
如果您对CoreData有大量的投资,那么您可能需要考虑编写自己的NSIncrementalStore来支持从键值存储中写入数据。
iCloud is only going to be a good solution if your data is sandboxed to a specific user. If you have multiple users that want to view the same data then it won't work.
只有当你的数据被沙盒覆盖到特定用户时,iCloud才会成为一个好的解决方案。如果有多个用户希望查看相同的数据,那么它将无法工作。
#1
3
You might want to checkout Couchbase Mobile. This would help with the synchronization you are looking for.
您可能想要签出Couchbase Mobile。这将有助于实现您正在寻找的同步。
If you have a significant investment into CoreData, then you may want to look at writing your own NSIncrementalStore to support writing data to and from a key value store.
如果您对CoreData有大量的投资,那么您可能需要考虑编写自己的NSIncrementalStore来支持从键值存储中写入数据。
iCloud is only going to be a good solution if your data is sandboxed to a specific user. If you have multiple users that want to view the same data then it won't work.
只有当你的数据被沙盒覆盖到特定用户时,iCloud才会成为一个好的解决方案。如果有多个用户希望查看相同的数据,那么它将无法工作。