Sample iOS project showing how to implement and use iCloud services.
- CloudKit API - simple database using CloudKit
- CloudKit + CoreData - simple database using CoreData with iCloud
- iCloud Documents - iCloud files synchronization
- Key-Value storage - UserDefaults stored in iCloud
Follow steps in this specific order. Remember, once you create an iCloud container, it can't be removed or edited, so be careful with the name.
- Open
iCloud Demo.entitlements
file and replaceiCloud.com.company.icloud-demo
with your own. It must start withiCloud.
- Go to project settings, select your target, select "Signing & Capabilities".
- Change bundle id to whatever you want.
- Select your TEAM.
- Open
AppConstants.swift
and replace container ID with your own.
It should generate provisioning profiles and create iCloud container. If iCloud container is highlighted with red color, try to refresh it or uncheck and check again.
Some features like CoreData automatic sync require real device. In this case, CoreData is using under the hood push notifications to track changes.
You can also try it out on simulator, however you need to sign in with your Apple ID to enable iCloud. Also syncing is working worse than on real device, therefore sometimes you may encounter some delays.
Use Features -> Trigger iCloud Sync
from simulator's menu to trigger synchronization.