Reputation: 18333
I am getting an NSValidationErrorObject when saving my managed object context. I am trying to save a couple objects and they all get the same error (from the user info):
NSDetailedErrors = (
Error Domain=NSCocoaErrorDomain
Code=1680 "The operation couldn't be completed. (Cocoa error 1680.)"
UserInfo=0x5d96fb0 {NSValidationErrorObject=<Alert: 0x5bb1fb0> (entity: Alert; id: 0x5bb0600 <x-coredata:///Alert/tBA1FD03B-5157-4523-AB34-A7C05869778F12> ;
data: {
...
identifier = "cap_024_0713_320117515151";
...}),
NSValidationErrorKey=identifier,
NSLocalizedDescription=The operation couldn\U2019t be completed. (Cocoa error 1680.),
NSValidationErrorPredicate=SELF MATCHES "",
NSValidationErrorValue=cap_024_0713_320117515151}
The thing that is confusing me is that I can find no reason for that key to cause a validation error. It is optional and as far as I know there is no validation enabled on it. Is there some other place to check for validation to be set up? Could this error message be reporting the wrong field?
Additional tests that i have now performed:
Upvotes: 2
Views: 1310
Reputation: 8357
the attribute name identifier
could be problematic - try myIdentifier
and see if it works
(i had a problem calling something description
because of the meaning in Obj-C)
Edited to reflect comments and results:
Delete the attribute all together, test to see if another failure crops up, then add it back if no error is present.
Deleting the "identifier" attribute and adding it again in Xcode fixed the issue. This was probably caused by an Xcode Core Data modeler bug.
Upvotes: 1
Reputation: 64428
I'm going to guess it is a naming collision caused by using "identifier" as a property name. It's similar to the error that crops up when people use "description" as a property name.
To test, change it to something else and see if it works.
Upvotes: 1