“Couldn't send a valid signature” error when using CloudKit

我怕爱的太早我们不能终老 提交于 2019-12-23 06:54:07

问题


Anyone know what could be causing this error which is returned in the query block below:

<CKError 0x7f8d5ba27a10: "Internal Error" (1/4000); "Couldn't send a valid signature">

Here is my code snippet:

CKContainer *container = [CKContainer defaultContainer];
CKDatabase *publicDatabase = [container publicCloudDatabase];

//CKDatabase *publicDatabase = [[CKContainer containerWithIdentifier:container] publicCloudDatabase];

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"doctorName = %@", @"Dr. Harry White"];
CKQuery *query = [[CKQuery alloc] initWithRecordType:@"WellnessTest" predicate:predicate];

[publicDatabase performQuery:query inZoneWithID:nil completionHandler:^(NSArray *results, NSError *error)
{
    if (error)
    {
        // Error handling for failed fetch from public database
        NSLog(@"ERROR: %@", error.description);
    }
    else
    {
        // Display the fetched records
        NSLog(@"Results: %@", results.description);
    }
}];

回答1:


On the iPhone/iPad simulator go to Settings > iCloud and then log in using your Apple ID.




回答2:


If you're testing your app against CloudKit's Production environment, you may still have this error even if you have signed into iCloud on the simulator. In this case, running your app on a device would fix the error.



来源:https://stackoverflow.com/questions/29886616/couldnt-send-a-valid-signature-error-when-using-cloudkit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!