iCloud Capabilities in Xamarin.iOS
Adding capabilities to an application often requires additional provisioning setup. This guide explains the setup needed for iCloud capabilities.
iCloud provides iOS users with a convenient and simple way to store their content and share it between devices. There are four ways that developers can use iCloud to provide a means of storage for their users: Key-Value storage, UIDocument Storage, CoreData, and using CloudKit directly to provide storage for Individual files and directories. For more information on these, refer to the Introduction to iCloud guide.
Adding the iCloud capability to an application is slightly more difficult than other App Services because of containers. Containers are used in iCloud to store information for an app, and allow all information contained in a single iCloud account to be segregated – like the sandboxing on a user’s iOS device. For more information on containers, refer to the Introduction to CloudKit guide.
Apple provides tools to help developers properly handle the European Union's General Data Protection Regulation (GDPR).
When provisioning a new app through the developer center there are two steps that need to be taken:
- Create a container.
- Create an App ID with the iCloud capability and add the container to it.
- Create a Provisioning profile that includes this App ID
The steps below will guide you through these steps:
Browse to the Apple Developer Center and go to the Certificates, Identifier, and Profiles section:
Under Identifiers select iCloud Containers, and then select the + to create a new container:
Enter a Description and a unique Identifier for the iCloud container:
Press Continue, ensure that the information is correct, and press Register to create the iCloud Container:
To create a new App ID and add a container to it, do the following:
In the Developer Center, click on App IDs under Identifiers:
Select the + button to add a new App ID:
Enter a Name for the App ID and give it an Explicit App ID:
Under App Services select iCloud and choose Include CloudKit support:
Select Continue and then Register. Note that on the confirmation screen, iCloud will display with Configurable selected, with a yellow symbol:
Return to the list of App IDs and select the one that you have just created:
Scroll down to the bottom of this expanded section and click Edit:
Scroll down the list to iCloud and click the Edit button:
Select the Container to use with this App ID:
Confirm the Container assignments, and press Assign.
This App ID can now be used to generate, or to re-generate, a new provisioning profile, as described in the Working with Capabilities guide.
For more information on using iCloud, refer to the following guides:
The list below describes additional steps that may need to be taken:
- Use the framework namespace in your app.
- Add the required entitlements to your App. Information on the entitlements required and how to add them is detailed in the Working with Entitlements guide.
- In the App's iOS Bundle Signing, ensure that the Custom Entitlements is set to Entitlements.plist. This is not the default setting for Debug and iOS Simulator builds.
If you encounter issues with app services, refer to the Troubleshooting section of the main guide.