Re: Validation error in a relationship? (in coredata)
Re: Validation error in a relationship? (in coredata)
- Subject: Re: Validation error in a relationship? (in coredata)
- From: Chris Hanson <email@hidden>
- Date: Sun, 14 Oct 2007 22:51:04 -0700
On Oct 14, 2007, at 2:37 AM, dexter.cocoa dexter wrote:
hello guys. I'm making a Core Data model. This model uses custom
NSManagedObject with some various methods. An entity have a
relationship 1:1 with the other. To set the releationship I've made
entity a setValue: entity_b forKey: mykey.
However when I save to the store I receive an error: mykey value
(entity b) is not valid (in entity A relationship destinatin is entity
b).
Why?
You need to not just post the error, but post a better description of
your model and a bit of the code that uses that model and fails.
A few things I've noticed from the error:
(1) You're not adhering to Cocoa coding conventions; your entities
have all-caps (rather than inter-caps) names, and your properties use
underbars rather than internal capitals. Core Data is not a SQL
database, it's part of Cocoa; rather than following (some platforms')
SQL naming conventions, you should follow Cocoa naming conventions.
(2) The error that comes back is a generic validation error (1550, see
<CoreData/CoreDataErrors.h>) indicating that the object on the other
end of the draft_content relationship is invalid in some way. That
doesn't necessarily mean that the content of the relationship is an
instance of the wrong entity (though we couldn't tell that without
seeing your model); it could be some other validation error. Do you
have any custom validation code on your entity classes?
(3) The error value contains a set that contains the object. Is it
perhaps the case that you tried to manipulate a to-one relationship as
if it were a to-many relationship, or the opposite (manipulate a to-
many relationship as a to-one)?
Beyond that, I can't really think of anything. Please share more
information about your problem to help us help you better. Thanks!
-- Chris
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden