24

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?

alan0xd7
  • 1,831
  • 1
  • 15
  • 19
  • Speculation: I doubt apple would release something with such a disadvantage to any of it's competitors. Parse is super cheap, easy to integrate, and has cloud code. If apple's thing was not any better, they probably would have bought it out (like they did with Testflight) – Fernando Mazzon Jun 05 '14 at 20:14
  • 1
    I am going through the same experience here: **A) Ooh this looks like a free (or cheaper) version of GAE. B) Oh wait I can't supply it with logic, cron jobs, and it will be limited to Apple devices so forget about extending your app anywhere beyond the initial databases. If choosing Cloudkit as a platform you are essentially backing yourself and your data into a dead end corner.** It would be interesting to see a few real world use cases of Cloud Kit. – Jonny Jul 08 '14 at 07:58
  • Can your server subscribe too? I like to get notified when something in the database changes so it can send a push notification to other platforms like Android as well. – Mark Sep 05 '16 at 18:47

5 Answers5

24

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

bshirley
  • 8,217
  • 1
  • 37
  • 43
Francescu
  • 16,974
  • 6
  • 49
  • 60
2

In some cases, we do not need server-side logic, and just storing static data can cover all the usage scenario.

In this case, it would be very helpful if there's a free accessible storage that you can store something. CloudKit provides such stuffs rather then full service platform.

Yes it is limited. Anyway can be useful for some people. For example, your case actually can be supported CloudKit. Though CloudKit is just a static storage, it support subscription. Which monitors a set of conditions and pushes the event notification to client. It's fortunate that the only background job feature supported by CloudKit is just what you need.

Anyway, if you need more, then you might need to consider full fledged servers. Usually simple web services with simple server-side code execution support are also limited.

eonil
  • 83,476
  • 81
  • 317
  • 516
  • Yes subscriptions sounds nice, but how would the CloudKit database get the news articles without any server-side code? You still need _something_ to go and get the news from somewhere and put it into the database. – alan0xd7 Jun 06 '14 at 11:39
  • @alanp21 Pulling news data doesn't have to be done in server machine. Nothing stop you to post new data from some client, and server just serve data. If you want crawling some news, you still can run the crawler on client machine, and can post only result to server. – eonil Jun 06 '14 at 12:01
2

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

You can and you can't. You can't upload code / SOAP based web services to the server, instead of it you can upload / store observers on the server, called subscription.

whole thing pretty limited and not really comparable?

I would say in CloudKit and in MBaas client communicates with server though a more narrower more robust interface: you can not upload exotic web service to do XML parsing, database manipulations and based on it trigger push notifications, but RestFull architecture allows you to perform the 4 basic operation on the data store, and with subscription client can get notified about INSERT / UPDATE / DELETE operations performed on tables.

I think MBaas is just the next step in evolution of server - client architecture. First it seems it is limiting, but you can do all as in SOAP based web services world. Development is extremely fast / scalable / comfortable to use and easier to control things like permissions / setup, maintain server, security needs almost no effort.

János
  • 32,867
  • 38
  • 193
  • 353
1

Believe it or not, you can actually get REALLY far with this approach.

I've not used CloudKit, but I can describe for you my application stack:

AngularJS (or your favorite client side HTML rendering framework): A single page will host a series of templates/controllers selected by the router and driven by users changing the anchor to select which page they're on.

Firebase.io (or your favorite cloud storage): Any dynamic data goes into the cloud document store. The controller needs to load the data and render the template on the client, and when the data changes, send the data back. This also provides the authentication and authorization as well, since you can limit access to the data.

Now you need a place to serve the HTML/CSS/JS/images... which requires no 'server side code execution', just a web server where you can put the assets.

Using this technique you could store all the user's topics in the database for that user, and when the page loads, go and aggregate all the sources for those topics (also stored in the database) completely client side. There's nothing in your example application which actually requires server side execution that I can see, so long as you have cloud storage which will provide you with authentication and authorization services, and a 'dumb' web server for serving up static assets.

  • That's all true for a non-server-side dev stack, but I think he's misunderstanding what CloudKit is for. – Patrick Gunderson Jun 06 '14 at 00:20
  • You could put all the processing on the client-side (in the app, on the phone), but I don't think it would be a very good user experience. Let's use podcast apps as a real life example - Pocket Casts use their own server to download all the RSS feeds and aggregate new episode information, so getting episode updates is very simple and fast. Another app, Downcast, downloads and processes the RSS feeds on your phone locally, and thus is a lot slower, especially when you have 10 or more subscriptions. – alan0xd7 Jun 06 '14 at 02:20
  • In my opinion, a true "cloud connected" app would have a server-side counterpart to improve the user experience (for data processing, communications, etc). This is not really what Apple has provided but is what the developers really need. – alan0xd7 Jun 06 '14 at 02:30
0

CloudKit isn't a full-fledged web hosting service. Instead, it's an SDK for iCloud. You shouldn't be putting a web site up there, just storing user data that you may want to use in multiple applications or platforms.

iCloud APIs enable your apps to store app data in iCloud, keeping your apps up to date automatically. Use iCloud to give your users a consistent and seamless experience across iCloud-enabled devices.

Patrick Gunderson
  • 3,263
  • 17
  • 28
  • Well, I guess my main issue is how everyone seem to be treating it. If you read some news related to WWDC from the past few days, many seem to suggest that Apple is offering a free alternative to services like Google App Engine or Amazon Web Services. But in reality CloudKit only really offers data storage and auth. – alan0xd7 Jun 06 '14 at 02:08
  • 1
    Yes, people seem to laud things they don't really understand. – Patrick Gunderson Jun 06 '14 at 17:24