I have a potential project that I’m considering; it’s a really simple application, but the client wants to have iCloud support. Now reading what I can find talks about using CoreData and then it should be pretty automatic?
So I’m wondering if anyone has done this with Xojo, if I take this contract I would rather use Xojo, but if iCloud support is going to be a real challenge I might have to consider using a different tool or skipping this contract entirely.
I was hoping that there might be an easier way, like writing my SQLdatabase in a specific location, but I can understand why that may not be the best thing.
Would be awesome if there was a database plugin for CloudKit
I’ve tried iCloud with Core Data (which in “local usage” writes to a sqlite file on the device) with Xcode / Objective C projects.
And I got the same impression such as in this article.
If it’s just a simple table (e.g. a list of some addresses). fine - that works (most of the time).
but as soon as there are relations - don’t even try it.
Because CoreData<->iCloud just doesn’t work, they now try developers to use CloudKit.
That might work better - i don’t know and haven’t tried.
But I think CoreData & Xojo would be a hughe project. You’d need Declares for just about everything.
While CoreData internally saved to a sqlite file, all you do is use “ManagedObjects”, “ManagedObjectContexts”, “PersistentStore(Managers)” and much more of that kind. Nothing that’s available in Xojo.
And there’s no point in trying to access and modify a “CoreData .sqlite” yourself with own logic.
No.
That “not really working” iCloud ↔ CoreData thing uses “Transaction logs”.
Basically, there’s a sqlite on the device. But only “Transaction logs” are synced to iCloud. Which then sends “transaction logs” (from other devices) back to all registered devices. Syncing/Merging those will not always work, so it’s up to the developer (app logic) to resolve syncing conflicts. But even worse, sometimes the (out-of-developers-hands) “Transaction logs” don’t find their “baseline” - and syning stops entirely.
And you don’t want to simply put a .sqlite in a “Cloud” (or Dropbox).
This would up/download the entire file for every single change. No way to have “Multi-user” support. They would just overwrite the other’s changes.
CloudKit is different from coreData<->iCloud
You have a database on Apple server and methods to “sync” your local and remote data.
So you have to define the tables you want to use on the server, how convert your local data in a acceptable format for the remote db (different data types).
For some kind of project is doable.
There is another way; that’s 100% unofficial. iCloud Drive is a mirrored folder on your machine, I intend to experiment with it at some point, but in theory if you were to write to this location, the OS would then sync it for you. However I would imagine that it will sync the entire file, rather than simply the transactions.
Yes, a sync module for iOS and macOS would be great. A global cross-platform sync module (Dropbox Box, Google, Amazon, etc) would be the best. I think many of Xojo developer were happy if a sync module were available.