Skip to content

CloudKit Overview

Stanislav Osipov edited this page Nov 7, 2020 · 1 revision

Store structured app and user data in iCloud containers that can be shared by all users of your app.

Overview

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.

Using the CloudKit Framework

CloudKit is not a replacement for your app’s existing data objects. Instead, CloudKit provides complementary services for managing the transfer of data to and from iCloud servers. Because it provides minimal offline caching support, CloudKit relies on the presence of the network and optionally a valid iCloud account. (A valid iCloud account is required only when you want to save data that is specific to a single user.) Apps can always store data in a public area that is readable by all users.

Records are at the heart of all data transactions in CloudKit. A record is a dictionary of key-value pairs that represents the data you want to save. You can add new keys and values to records at any time, and you can create links between related records to organize your data. The ISN_CKRecord class defines the interfaces for managing the contents of records.

Turn on CloudKit functionality.

In order to have access to CloudKit functionality, you need first to turn in on in plugin settings. You need to find Stan's Assets in the menu, then go Stan's Assets->iOS->Service and in this tab

serviceTab

find CloudKit and turn it on. After this, you will get access to CloudKit functionality and CloudKit.framework will be added into your Xcode project after the build. Now you can create and save, fetch, and delete your records from iCloud, about how to do it you can find here and here.

Set up dashboard account.

With the CloudKit Dashboard, you’ll have a detailed view of your app’s server activity. Inspect data, maintain your database schema, measure user activity, bandwidth usage, and monitor trends over time so you can test and develop new features with confidence. To have access to CloudKit Dashboard you need to add a dashboard container into your project. You can do it in unity project or in Xcode.

Add dashboard container into the Unity project.

To do this you need to find Stan`s Assets in the menu

menu

then go iOS->XCode->Compatibilities, there find the iCloud section

iCloud and here turn it on, and add your dashboard container id into Custom Containers. After all this, it should be added to your XCode project automatically in post-processing.

Add dashboard container into the Xcode project.

In the Xcode project, you need to go to Sign-in & Capabilities tab

signintab

Then push Capabilities button, in a pop-up find and choose iCloud. After this, it will be added to your project

iCloud

and here you need to turn on CloudKit and choose your container as shown above.

About

Foundation

AV Foundation

App Tracking Transparency

Game Kit

Store Kit

UI Kit

Social

Replay Kit

Contacts

AVKit

Photos

App Delegate

User Notifications

MediaPlayer

Core Location

AdSupport

EventKit

CloudKit

Authentication Services

XCode

Knowledge Base

Clone this wiki locally