CloudKit - no server-side logic?

alan0xd7 picture alan0xd7 · Jun 5, 2014 · Viewed 10.1k times · Source

With CloudKit, you can focus on your client-side app development and let iCloud eliminate the need to write server-side application logic. CloudKit provides you with Authentication, private and public database, structured and asset storage services — all for free with very high limits.

You cannot upload any code to run on Apple's servers?

I've heard it being compared to Google App Engine and other cloud computing platforms, but without the ability to run your own code, isn't the whole thing pretty limited and not really comparable?

For example, if I want to build a news app which periodically pushes stories on topics that the user is interested, then this can't be done just using CloudKit because I would need scheduled jobs and data processing on the server.

Any thoughts?

Answer

Francescu picture Francescu · Jul 13, 2014

Server-side

As you said CloudKit doesn't allow server-side code.

But there are possibilities.

Crons

You don't want to connect to the iCloud Dashboard everyday in order to perform the push by adding a record. One solution here is to code an app on a mac server (I guess mac mini as server will become more popular with CloudKit) that add a new Daily CKRecord every day.

Subscriptions

Subscriptions concept is that the client registers for specific updates. You can create a record type called Daily for instance and make users register to it. You should check the Apple documentation and WWDC14 videos (even if Subscriptions are not detailed, it's a good start point).

The good thing is push notifications are linked with the subscription concept. So basically you say: Send my a notification for each new CKRecord of type Daily added.

BaaS party

What is the point for using CloudKit (vs Parse and other?)

  • Price: CloudKit has a really nice pricing
  • Ready to go: 2 clicks inside XCode and you are ready to go
  • User consistency: you get free user login for all his devices through their iCloud account. With a very good privacy system. And you can get relationships with a smart system.

But:

  • You are stick on Apple platform. We don't even know if we could export the data..
  • Only data-centered for now (no server-side code)
  • The CloudKit dashboard is too limited

The future

CloudKit is still pretty new. At the WWDC some guys behind it made me understand that they are still heavily working on it. My bets are they are working on 2 important points :

  • Server side code execution through remote scheduled tasks
  • CloudKit for Analytics (Visualization side)

Edit: Apple guys are fully aware and concerned about the lack of web access for the data. It means that one day it may be accessible from other platforms. I read in a comment that Apple probably would have bought Parse if CloudKit wasn't better, AFAIK they tried to buy Parse (skills buy it's said, but we don't really know).

Update WWDC15

CloudKit is now available in JS and some dashboard are available now. Wait and see.

Update February 2016

CloudKit Now Supports Server-to-Server Web Service Requests

Web Services Reference