1
votes

I have an error with Core Data :

{ NSLocalizedDescription = "The operation couldn\U2019t be completed. (Cocoa error 1570.)"; NSValidationErrorKey = CorbeilleItem; NSValidationErrorObject = " (entity: ACSheetList; id: 0xde22cd0 ; data: {\n Actions = \"\";\n CorbeilleItem = nil;\n Sections = \"\";\n idDoc = 0;\n title = nil;\n})"; }

My Data Model is next :

And my source code is :

        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]);
        }           

Could you help me, please?

1

1 Answers

0
votes

I am facing the same issue, with scalar values of the core-data object while migrating. try using KVC to set values ie. use

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

instead of

[newSheet setCorbeilleItem:item];

It worked for me.