Search code examples
iosicloudcloudkit

Notify about CloudKit Availability


Overview

I would like to be notified when CloudKit is not reachable.

Possible scenarios when CloudKit might not be reachable:

  • CloudKit server is not accessible
  • Internet connectivity is not available.

Attempts made so far:

  • Observe CKAccountChanged Notification
  • Observe NSUbiquityIdentityDidChange Notification
  • Check CKContainer.accountStatus(completionHandler:)

None of the above approaches notifies when there the connectivity is lost.

Questions:

  • Is there a special way to be notified when CloudKit is not accessible or do we have to use SCNetworkReachability ?
  • If SCNetworkReachability is to be used what is the URL to check ?

Solution

  • There's no CloudKit notification that alert user about an Internet connection lost.

    You're right, in order to check the Internet connection availability you need SCNetworkReachability.

    About SCNetworkReachability, there's no need to check your connection against any server. This repository has an implementation that allow developer to check agains a server o without it.