Search code examples
androidioscloudkit

Can I use CloudKit on Android or web-based app?


I've been coding an app, and using CloudKit would make my life a lot easier. However, this app needs a web-base app along side the iOS app. I was wondering if there was any way I could use CloudKit with Android or web-based apps.

While this might not directly possible with an API provided by Apple, another possibility would be to use OS X Server for CloudKit. Would that be possible too/comply with Apple's Terms of Service for CloudKit?


Solution

  • Yes you can. Apple provides CloudKit JS, specifically designed for web services. I don't know much about Android, but I'm pretty sure it'll be not a hard challenge to run JavaScript.

    Also CloudKit WebServices could be interesting for you.

    EDIT advice and discussion

    To give you an honest advice: Better use something "own". I currently work with a custom server on an AWS EC2 instance and am really happy.

    You could, for example, write a really simple server using Node.js and connect a Mongo DB NoSQL database. CloudKit is actually not more than this.

    This is really a simple task. I did this before and with some JavaScript experience and a few days Node exercises it is absolutely feasible; you'll write really nice servers very quickly.

    In the end, when dealing with more customers, CloudKit will be more expensive, actually. And if you, why ever, must move to a different service, you will have trouble with CK, because you are not able to access the privately stored data.

    Also, be sure that CKs concept fits your needs. I was in your situation a few months ago. As I read more about CloudKit and viewed some WWDC sessions, I more and more realised that it is not a BAAS as you would probably expect.

    One example: You have no access control: private or public, thats it. There is a public database which everyone can access each resource in. And a private one for any user, which is inaccessible by others.

    If you don't want to, or can't, do something on your own, you could simply use BAASBOX for self-hosted APIs or just any commercial BAAS.


    EDIT II

    To point that out again for anyone late in the game:

    The private (per-user) databases are absolutely inaccessible for others – even you as the developer and operator can't access the, most probably encrypted, data to move to a different (maybe self-hosted) service.

    You'd need to make an update and the app then needs to move the data to your new service on the users behalf – "device-ly".

    These kind of processes are typically problematic because you'd need to run two services until all active users moved their data – which is REALLY hard to tell; your customer might be idle for some time and they'd be upset if their data is lost in void forever.

    Ok – Cloudkit might continue until... Yeah, until then. So it might not be as problematic to do that kind of passive longterm-movement.