CloudKit - no server-side logic?

前端 未结 5 858
梦谈多话
梦谈多话 2020-12-25 13:09

With CloudKit, you can focus on your client-side app development and let iCloud eliminate the need to write server-side application logic. Cl

相关标签:
5条回答
  • 2020-12-25 13:52

    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.

    0 讨论(0)
  • 2020-12-25 13:56

    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

    0 讨论(0)
  • 2020-12-25 13:58

    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.

    0 讨论(0)
  • 2020-12-25 14:02

    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.

    0 讨论(0)
  • 2020-12-25 14:09

    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.

    0 讨论(0)
提交回复
热议问题