iCloud

Has anyone done anything with iCloud and Xojo, I’m designing a project at the moment and I want to use iCloud. So that the data can be synced between apps running on macs as well as the iPhone/iPad (when Xojo compiles iPhone/iPad).

My data is limited in relational, so I’m trying to decide if I should store all of it in a document and use document syncing or use Key/value storage? I do however have a concern about concurrency as I’d like to allow users to edit the data from all their devices, without concern about locking and such.

Is it hard to set-up?

We have iCloud support in our plugins.
But I want to note that you need to put in a lot of work and your clients only can use it if they buy your app through Mac App Store.
So if you plan to implement something for other clients, you may go directly with your own sync solution.

[quote=33098:@Sam Rowlands]Has anyone done anything with iCloud and Xojo, I’m designing a project at the moment and I want to use iCloud. So that the data can be synced between apps running on macs as well as the iPhone/iPad (when Xojo compiles iPhone/iPad).

My data is limited in relational, so I’m trying to decide if I should store all of it in a document and use document syncing or use Key/value storage? I do however have a concern about concurrency as I’d like to allow users to edit the data from all their devices, without concern about locking and such.

Is it hard to set-up?[/quote]
As far as i know, for database syncing you’re going to need Core Data which is not supported by Xojo so far.

I looked into making this work using MBS about a year ago. It was painful with lots of hoops to run through. In the end, I was not able to make it work so I just gave up. The MBS plugin for iCloud was pretty new back then though (I tried it the week it was first announced). Perhaps Christian has improved on them since then.

Hi Christian, I see that you have the functions in your plugin.

My questions may not be clear, but I’m more thinking about how best I can save my data to make it most compatible with iCloud. I intend to store all the user data on the machine, then basically use iCloud to synchronize the data.

I’ll keep reading the Apple docs, until something strikes me.

How much data do you want to synchronize? How complex is the data? I think that for a smallish amount of simply structured data iCloud may make sense. For anything else read lots of fun blog entries of failing to do iCloud sync correctly. See

Jumsoft
Bare Bones
Ars Technica

HTH

It’s not very complex data, there just could potentially a lot of it, maybe 1000s of records (although I doubt seriously 10,000s).

While the project is in very early design stages, I was just trying to decide if I should use a single file or multiple files (which could work with Key/Value pairs).

I’ll do some more reading and perhaps if anyone else is interested I’ll write up what I’m find.

Well, I did make a working example for my tests here a few weeks after I finished creating those classes. So Nona, if you tried in-between you may had trouble. Maybe you check current plugin examples again?

Christian, I will certainly give it another try in the next few days.

The current example is dated Jun 2014, and demands OSX10.7
Yet it is in the Lion plugin.

Is there an example that still works with 10.6?
And does anyone have any explanation of what the example does anywhere?

[code]query = new MyNSMetadataQueryMBS

			dim paths() as string
			paths.Append query.NSMetadataQueryUbiquitousDataScope
			'paths.Append query.NSMetadataQueryUbiquitousDocumentsScope
			query.setSearchScopes paths
			
			// dummy predicate to find all items
			dim args() as Variant
			args.Append NSMetadataItemMBS.NSMetadataItemFSNameKey
			dim pred as NSPredicateMBS = NSPredicateMBS.predicateWithFormat("%K LIKE '*'", args)[/code]

I am struggling to find out what a QueryUbiquitousDataScope is, for example.

To be honest, I was expecting something like

dim f as folderitem f = iCloudMBS.folderitem("hello.txt")

or similar. Perhaps with some element of user id login?

Has anyone got this working ?

from Apple docs:

[quote]// -setSearchScopes: will throw an exception if the given array contains a mix of the scope constants below with constants above.
FOUNDATION_EXPORT NSString * const NSMetadataQueryUbiquitousDocumentsScope NS_AVAILABLE(10_7, 5_0); // “Documents” subdirectory in the application’s Ubiquity container
FOUNDATION_EXPORT NSString * const NSMetadataQueryUbiquitousDataScope NS_AVAILABLE(10_7, 5_0); // application’s Ubiquity container, excluding the “Documents” subdirectory[/quote]

so those constants are Mac OS X 10.7 only. Sorry.

Thanks for replying, Christian.

I assume those constants weren’t in the previous plugin version.
And presumably if you don’t use them it would work on 10.6

No matter: I dont understand any of the above code so I’ll have to give it a miss.

The constants are defined in the plugin, but they don’T return a value on 10.6.

You can of course try it, but Apple normally has a reason to say it’s 10.7+ only.

That would be because you can’t use iCloud with 10.6 - Apple