2

I have an application that stores its files on iCloud Drive for synchronization. I'd like to write a cloud service that can also access the files.

For example, if I record a video on my app, I'd like to ask my service to download the file, and send it to a transcoding service, or something.

From the device, can I create an authenticated URL to the file? Alternatively, can I create a temporary token to send to the server, so that it can access the file? Then, when transcoding is complete, can I write back to the iCloud Drive?

I'm mostly trying to avoid uploading the entire file from the device to the server, because the files might be quite large.

I'm also trying to use iCloud Drive to support the seamless file sync between device and mac laptop without having to explicitly authenticate - that type of thing isn't supported by google drive, or dropbox, correct?

Thanks very much in advance, I appreciate any help at all!

2

CloudKit

Apple offers CloudKit, which achieves something very similar to what you are describing.

If you're able to write an application both for your Mac and iOS device, you can sync data and files across devices relatively easily. For example, CloudKit allows you to store files and data in a free database, process it however you want in your apps, then re-upload it to the database. All of this happens without any explicit authentication.

The CloudKit framework provides interfaces for moving data between your app and your iCloud containers. You use CloudKit to take your app’s existing data and store it in the cloud so that the user can access it on multiple devices. You can also store data in a public area where all users can access it.

CloudKit | Apple Developer Documentation

Keep in mind that while CloudKit itself free and easy to use, there is a caveat; You have to have a paid Developer account, which costs $99 a year.

I would highly recommend you look into CloudKit and check out Apple's (outdated) CloudKit Quick Start guide to get a feel for how programming for it actually looks.

Access from Non-Apple Platforms

While CloudKit works best when used on an Apple device, it is certainly possible to interact with a CloudKit container with more platform agnostic methods.

The best solution may be to use CloudKit web services. This allows you to use either more traditional HTTP methods or JavaScript to interact with CloudKit data.

The part of CloudKit web services that has more up to date documentation is CloudKit JS, a JavaScript API for CloudKit.

Keep in mind that with either of these options, Apple says that, “You must have an existing CloudKit app and enable web services.” Details on how to setup CloudKit web service are in the linked CloudKit JS guide

  • Hi Jake, thanks for the answer. I'm actually looking for something that could access iCloud Drive files from (for instance) a linux server. I'd like to be able to do things with files "behind the scenes", so to speak. If there were some sort of authentication (and a URL) to a file in iCloud drive that would allow me to access the file from my linux server, that would be the solution. (Unless there actually is something in cloudkit that addresses that, and that I've missed, my apologies if so) – Hoopes Jan 8 at 13:06
  • Thanks! I do know of a few ways to acess CloudKit on non-Apple platforms. I’ll update the answer soon. – Jake3231 Jan 8 at 13:12
  • just pinging on this - i haven't found anything legit out there yet, was wondering what you might have in your bag of tricks. – Hoopes Jan 10 at 3:13
  • @Hoopes I have updated my answer with more information. – Jake3231 Jan 11 at 5:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .