iCloud and SQLDatabase

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.

Have you looked at CloudKit?

I would like to achieve the same but had no time yet to investigate CloudKit CKContainer.

Thanks Guys, very interesting.

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 :slight_smile:

I also use SQLite in my app. I guess there’s currently no straight forward way to achieve iCloud syncing of that database?

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.

Well, I could of course write a plugin for this if there is interest.

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.

be aware that CloudKit is 64-bit only on Mac!
And it may require your app to be in the App Store.

CloudKit exists and can be used also on iOS (you can define the entitlement in Xojo)

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.

A Ready-To-Use Database Sync Solution based on CloudKit, is all that keeps me from starting to Develop for iOS. :wink:

Well, but would use want to use Cloud Kit for an app?
That would be 64-bit only and App Store only?

You normally use Xojo for cross platform apps, so you need to write something yourself for Windows/Linux, 32bit or selling outside the Mac app store.

[quote=252845:@Christian Schmitz]Well, but would use want to use Cloud Kit for an app?
That would be 64-bit only and App Store only?[/quote]

For me this would be fine. I am a Mac Dev. (Even while my biggest Project is a X-Platt Project i dev+maintain for the Company i am working at) :slight_smile:

Any Update on this one @Christian Schmitz ? :slight_smile:

All the 64-bit development is difficult without a debugger and beside you there nobody asked for this.

+1… interesting for me too…

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.

Let’s start with iCloud please