Last active
July 27, 2018 19:01
-
-
Save insidegui/5523796b377133a637855e837acfbb7d to your computer and use it in GitHub Desktop.
Obtaining the user's iCloud account status using CloudKit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CKContainer.default().accountStatus { status, error in | |
if let error = error { | |
// some error occurred (probably a failed connection, try again) | |
} else { | |
switch status { | |
case .available: | |
// the user is logged in | |
case .noAccount: | |
// the user is NOT logged in | |
case .couldNotDetermine: | |
// for some reason, the status could not be determined (try again) | |
case .restricted: | |
// iCloud settings are restricted by parental controls or a configuration profile | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment