iosicloudios8icloud-apicloudkit

How do I check if user can login to CloudKit?


Can I use the same way I check for iCloud availability or is there some other way of checking for CloudKit availability?


Solution

  • The CKContainer class has a method called accountStatusWithCompletionHandler: that's designed for this purpose. Call it and check for CKAccountStatusAvailable. You'll still need to listen for NSUbiquityIdentityDidChangeNotification in case the status changes.