Firstly I am aware of this post: How to identify iCloud logged in user in airplane mode?
It doesn't seem to have an answer though. One answer talks about detecting Internet connectivity and the other talks about wether or not the user has changed.
Here is my code:
container.accountStatusWithCompletionHandler{
(status: CKAccountStatus, error: NSError?) in
dispatch_async(dispatch_get_main_queue(), {
var title: String!
var message: String!
if error != nil{
title = "Error"
message = "An error occurred = \(error)"
} else {
//title = "No errors occurred getting info"
switch status{
case .Available:
message = "The user is logged in to iCloud"
title = "GOOD"
print("determined status was available")
self.shouldPullFromICloud()
//self.displayAlertWithTitle(title, message: message)
case .CouldNotDetermine:
message = "Could not determine if the user is logged" +
" into iCloud or not"
title = "BAD"
self.noUserIsSignedIn()
case .NoAccount:
message = "User is not logged into iCloud"
title = "BAD"
self.noUserIsSignedIn()
case .Restricted:
message = "Could not access user's iCloud account information"
title = "BAD"
self.noUserIsSignedIn()
}
print(title, message)
}
})
}
Seems pretty stupid that you need an internet connection to see if a user is signed into iCloud. How can I fix this?
Thanks!
P.S. If that other post does contain the answer to my question can you please highlight it for me? I couldn't find it. Cheers!