Join Todd Perkins for an in-depth discussion in this video Understanding how iCloud works, part of Developing for the Apple iCloud API with iOS.
- So let's talk about what iCloud is. iCloud is a set of services that allow for various types of cloud data storage. So what that means is we have several different ways to send data to and from the cloud. The first is key-value storage. So this basically saves data in a key-value pair dictionary. And we can send that to the cloud, and bring that from the (mumbles). We're limited in the amount of data that we can use with key-value storage, so this is usually recommended to use user preferences or app configuration data and so forth.
Documents can also be stored in iCloud. That means we can create files of existing file types and even our own made-up file types. We can save documents in iCloud and we can reference them through iCloud Drive. So we can use iOS 9's iCloud Drive app and look at, say, text files that we've created. And we can see those same files inside of iOS 10 by going to the iCloud Drive folder. So we can create those.
There's also CloudKit, and CloudKit gives us a database to work with so that we can save records into the database, which are key-value pairs. And this isn't quite like key-value storage, where we are limited with our size to one megabyte. CloudKit gives us a lot of storage and lot of power to save structured data to the cloud. Now beyond the scope of this course, you can also use core data with iCloud. We'll talk about where you can find information about core data at the very end of this course.
So if you're interested in that, I'll show you where you can find that information. So what do you actually need to develop for iCloud? Well you're going to need a developer account, of course, because you want to be running this on a device. Ad you're using the iCloud server, so you're going to need that developer account to get started. You're also going to need an iCloud login, which is your Apple ID. And you need to have devices, or maybe just a simulator, if you don't have iOS devices. So optionally, you can have devices to test along with a simulator, though most of what we're doing will work in the just the simulator alone.
Finally, these devices need to be logged into the same iCloud account. You need to make sure that the documents and data setting is on, so that you can access this data between different devices.
- Working with iCloud key-value pairs
- Building an example app that accesses iCloud documents
- Saving and loading iCloud documents
- Fetching records with CloudKit