Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving CloudKit Record "Not Authenticated" (9/1002)" "This request requires an authenticated account""

Tags:

Saving a CKRecord in the simulator gives me the following error:

[publicDatabase saveRecord:cloudRouteEntity completionHandler:^(CKRecord *record, NSError *error) {
    if (error) {
        NSLog(@"An error occured in %@: %@", NSStringFromSelector(_cmd), error);
        abort();
    } 
    else {
        dispatch_async(dispatch_get_main_queue(), ^(void) {
            //GUI
            NSLog(@"Created Cloudkit Entity");
        });
    }
}];

However, it works on the phone. Why does the simulator not have access to the CloudKit database?

EDIT: I thought I'd be clever by adding the iCloud account to the simulator - but iCloud moans that this is not allowed on "this device" (simulator). Ideas anyone?

like image 768
brainray Avatar asked Oct 08 '14 09:10

brainray


2 Answers

I got the same problem, which I was able to resolve by logging in to my iCloud account in the simulator (Settings > iCloud).

As of the latest Xcode, you can log in to your iCloud account in the simulator, and everything should work.

If you are having trouble logging in, try to go to iCloud.com on a desktop and log in there first. Once that is set up properly, then try in the simulator.

like image 198
Senseful Avatar answered Sep 21 '22 11:09

Senseful


I'm seeing the same error. According to the discussion linked below the cause might be two-factor authentication.

https://discussions.apple.com/thread/6588883

like image 25
Ronald Mannak Avatar answered Sep 22 '22 11:09

Ronald Mannak