【问题标题】:NSValidationMissingMandatoryPropertyError - The operation couldn't be completed. (Cocoa error 1570.)NSValidationMissingMandatoryPropertyError - 操作无法完成。 (可可错误 1570。)
【发布时间】:2011-10-31 16:41:18
【问题描述】:

我对核心数据有一个错误:

{ NSLocalizedDescription = "操作无法\U2019完成。(Cocoa 错误 1570.)"; NSValidationErrorKey = CorbeilleItem; NSValidationErrorObject = " (entity: ACSheetList; id: 0xde22cd0 ; data: {\n Actions = \"\";\n CorbeilleItem = nil;\n Sections = \"\";\n idDoc = 0;\n title = nil ;\n})"; }

我的数据模型是下一个:

我的源代码是:

        ACSheetList *newSheet = (ACSheetList*)[NSEntityDescription insertNewObjectForEntityForName:@"ACSheetList" inManagedObjectContext:self.managedObjectContext];

        @try {

            if ([item isFault] == YES) {
                NSLog(@"CorbeilleItem is fault");
            }

            if ([item isDeleted] == YES) {
                NSLog(@"CorbeilleItem is deleted");
            }

            [newSheet setIdDoc:documentIdTemp];
            [newSheet setTitle:@"title 0"];

            [newSheet setCorbeilleItem:item];
            [item setSheet:newSheet];
        }
        @catch (NSException *exception) {
            [self addTrace:ERROR description:exception.reason];
            NSLog(@"%@", [exception userInfo]);
        }           

你能帮帮我吗?

【问题讨论】:

    标签: core-data


    【解决方案1】:

    我面临同样的问题,迁移时核心数据对象的标量值。 尝试使用 KVC 设置值,即。使用

    [newSheet setValue:item forKey:@"corbeilleItem"]; 
    

    而不是

    [newSheet setCorbeilleItem:item];
    

    它对我有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-29
      相关资源
      最近更新 更多