Reputation: 920
I am getting following three warning when I compile my core data project
I am not setting an inverse since any change to file Object does not effect the photo Object.And I don't even need to access photo object from the file object
Misconfigured Property:
Photos.file should have an inverse
Consistency error:
Photos.file does not have an inverse; this is an advanced setting (no object can be in multiple destinations for a specific relationship)
I am setting no action since any change to Factilities Object does not effect the ParentGroup Object.But I need to access ParentGroup object from the Factilities object
Consistency error:
Setting the No Action Delete Rule on Facilities.parentGroup is an advanced setting
Do I get rid of them or is it ok to to have these warning ?
Upvotes: 1
Views: 3495
Reputation: 920
Misconigured property can be handled by setting an inverse relationship. It just that I never use that inverse relationship. Or it can be handled as flexaddict explained.
I ended up doing the following for NO action
I set NO ACTION to nullify . I had this concept incorrect. Nullify means that it will remove the source object from the inverse relationship coming from the destination object. It does not mean the it will delete the destination object all together.
Upvotes: 0
Reputation: 33428
If you don't need to model an inverse relationship is ok. Warnings are not errors. They are just saying that you are responsible for extra stuff as highlighted in Apple doc (in bold key parts).
It is not strictly necessary to model a relationship in both directions. In some cases it may be useful not to, for example when a to-many relationship may have a very large number of destination objects and you are rarely likely to traverse the relationship (you may want to ensure that you do not unnecessarily fault in a large number of objects at the destination of a relationship). Not modeling a relationship in both directions, however, imposes on you a great number of responsibilities, to ensure the consistency of the object graph, for change tracking, and for undo management. For this reason, the practice is strongly discouraged. It typically only makes sense to model a to-one relationship in one direction.
Anyway, I think you should also be able to fix the warning following this discussion: How to disable no inverse relationship warning for CoreData in Xcode 4.2?.
Hope that helps.
Upvotes: 8