iCloud is the thorn in Apple’s side. They have been trying to get this right forever. Maybe it works now from an end-user perspective, but as a developer, what a rough, confusing implementation.
I have to say, when you work with the Dropbox API, it is intuitive, it is easy, it is straightforward. Perhaps you have to write a lot of boilerplate code, but then again, do you? It manages files. This name, that path, that revision number, that modifiedDate. You sort out the rest. How hard can that be?
I’m currently writing a sync engine that allows users to decide which cloud service they want to use to backup their data. So of course it would make sense to have one common API that wraps the various services.
It went so smoothly with Dropbox. The only difficulty I had was realizing that the serialization of date strings sometimes results in small differences in the Date that emerges, meaning I had to write a .isTheSameAs(other: Date) method, which checks to see if they are within X seconds of each other, then call those ‘the same’.
Then I moved on to iCloud. What a clusterf•ck. Talk about over-engineering and complete inflexibility. I just want a list of files that are in the cloud. No, Apple has to distinguish whether you have them locally or not, and gives them a different URL. And all sorts of other weird stuff.
So I tried to find a framework that makes iCloud a little more user-friendly, called iCloudDocumentSync which I found to be pretty straightforward, all things considered. And yet, it’s still a pain. Because iCloud uses multiple URLs to represent the same document. In the end, I have to sync the entire iCloud folder’s contents before I can start working with these with a common URL. (Sure I could extract the file name I need). Moreover, iCloud uses a thread to open each document, so if I want to batch download a lot of data, suddenly I have a thread explosion. Now I have to deal with managing that.
All in all it’s just been a pain to work with it. It seems opaque in its verbosity. Meaning, the person who talks a lot doesn’t get listened to and understood. There are so many callbacks and all sorts of weird things going on, it’s very annoying. Just because they’re trying to save the developer time, they’ve implemented something weird and unwieldy if you don’t use it according to their use case. I personally just use a UIDocument as a means to save data. I don’t work with UIDocuments because my app’s data model uses the data, but not the file. This just seems silly with iCloud.