I am currently trying to get the iCloud ID of the user. It worked for about 2 months but today when i re-tested, it is not working anymore.
I have the following code:
func iCloudUserIDAsync(complete: @escaping (_ instance: CKRecord.ID?, _ error: NSError?) -> ()) {
let container = CKContainer.default()
container.fetchUserRecordID() {
recordID, error in
if error != nil {
print(error!.localizedDescription)
complete(nil, error! as NSError)
} else {
print("fetched ID \(recordID?.recordName ?? "")")
complete(recordID, nil)
}
}
}
And i am getting the "No iCloud account configured" error altough i am signed into iCloud on my iPhone and i also enabled iCloud Drive.
It is working on my other iPhone (7 Plus) but on my main development XS it is giving me this error
I logged out of iCloud and logged back in and then in worked.
@matt answered correctly