在CloudKit中执行查询时,我一直看到此错误。以下是通常将其设置的代码:
if (self.userID) {
CKReference *referenceToUser = [[CKReference alloc]initWithRecordID:self.userID action:CKReferenceActionDeleteSelf];
NSPredicate *userSearch = [NSPredicate predicateWithFormat:@"%K == %@", @"User", referenceToUser];
CKQuery *findHoneymoon = [[CKQuery alloc]initWithRecordType:@"Honeymoon" predicate:userSearch];
CKQueryOperation *findHMOp = [[CKQueryOperation alloc]initWithQuery:findHoneymoon];
findHMOp.resultsLimit = 1;
__block CKRecord *userHoneyMoon;
findHMOp.recordFetchedBlock = ^(CKRecord *record){
userHoneyMoon = record;
self.userHoneymoon.honeymoonID = record.recordID;
};
__block BOOL errorOccured = NO;
findHMOp.queryCompletionBlock = ^(CKQueryCursor *cursor, NSError *operationError){
if (operationError)
{
NSLog(@"Error searching for user honeymoon, description: %@, and code: %lu, and heck, heres the domain: %@", operationError.localizedDescription, operationError.code, operationError.domain);
[[NSNotificationCenter defaultCenter]postNotificationName:@"HoneymoonError" object:nil];
errorOccured = YES;
}
if (!userHoneyMoon && !errorOccured)
{
[self createBlankHoneymoon];
}
else
{
[self.userHoneymoon populateHoneymoonImages];
}
};
[[[CKContainer defaultContainer] publicCloudDatabase] addOperation:findHMOp];
}
真正令人烦恼的是,这个错误只发生在我尝试运行程序的大约五次中。
以下是发生错误时记录的内容:
搜索用户蜜月时出错,说明:请求中没有操作,代码:12,哎呀,继承人域:CKErrorDomain
正如您从代码中可以看到请求中的ARE操作,是否有人知道可能发生此错误的任何其他原因以及如何处理它?</ p>