CloudKit - fetchUserRecordID() not working when iCloudDrive is disabled.

Originator:PPacie
Number:rdar://32277653 Date Originated:05/18/2017
Status:Opened Resolved:
Product:iOS + SDK (CloudKit) Product Version:
Classification:CloudKit Reproducible:
 
Area:
CloudKit

Summary:
CKContainer.default().fetchUserRecordID returns 'No iCloud account is configured' (code error 9) if the iCloudDrive is DISABLED but the user is logged into iCloud. This is a bug as the UserRecordID should return if the user is logged into iCloud anyway. 

iCloudDrive should only be required when we need to make use of the disk space in iCloudDrive.

Steps to Reproduce:
Try to get the iCloud UserRecordID.

Ref:
https://developer.apple.com/reference/cloudkit/ckcontainer/1399191-fetchuserrecordid

Expected Results:
CKContainer.default().fetchUserRecordID() { recordID, error in
            if let userID = recordID {
//This should get called if user is logged into iCloud, even if iCloudDrive is disabled.
                print("fetched ID \(userID.recordName)")
            } else if let error = error as NSError? {
print("Error Code:", error.code, "Error Description:", error.localizedDescription)
            }
        }

Observed Results:
CKContainer.default().fetchUserRecordID() { recordID, error in
            if let userID = recordID {
                print("fetched ID \(userID.recordName)")
            } else if let error = error as NSError? {
//This get called if iCloudDrive is disabled. Even if the user is logged into iCloud.
print("Error Code:", error.code, "Error Description:", error.localizedDescription)
            }
        }

Version:
iOS 10.3.2(14F89)
It also happens in iOS 9.3 but the error message is:  "This request requires an authenticated account"

Comments

I just duped this. Radar #34028114.

This is so annoying. :)

Thanks!


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!