• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CoreData warning: File.children -- to-many relationship does not have an inverse:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreData warning: File.children -- to-many relationship does not have an inverse:


  • Subject: Re: CoreData warning: File.children -- to-many relationship does not have an inverse:
  • From: Quincey Morris <email@hidden>
  • Date: Tue, 3 Aug 2010 13:59:28 -0700

On Aug 3, 2010, at 13:37, Ignacio Enriquez wrote:

> User can create files and folders (they don't have to be real folders/files).
> Folders can contain files or other folders
> Files have:
> title,
> summary and
> 8 children
> Each child also has a title and a summary and could have 8 children (optionally)
> This could be as many levels (recursive) as the user desires.
> I am not sure how to express this in CoreData. Could someone give a hand here?
>
> This is what I've done: http://yfrog.com/j2o1op
>
> "Child" entity with "title" and "summary" attributes and "children"
> (to-many) relationship pointing to "Child" entity
> "File" entity with "isDirectory" and "name" attributes and "files"
> (to-many)  relationship pointing to "File" entity  and "children"
> (to-many) relationship pointing to "Child" entity.
>
> Doing that gets me a warning:
> File.children -- to-many relationship does not have an inverse:  this
> is an advanced setting (no object can be in multiple destinations for
> a specific relationship)
> Why is that? I've tried to set the inverse relationship but there are
> no options to choose from.

According to this description, you're not missing one inverse, you're missing 3 of them: File.parentFile, Child.parentChild and Child.parentFile. If that sounds a bit weird that's because your design is a double tree structure with 2 entities in it.

So one approach is to add the 3 missing 1-1 relationships. (A Child object has a parentChild or a parentFile but not both. Or maybe it can have both -- your description doesn't exactly rule out that this might be your intention.)

The kind of structure you're trying to model would be easier if Core Data allowed mixed entities in a relationship, but it doesn't, so you have to the long way round to get the results you want.


_______________________________________________

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

References: 
 >CoreData warning: File.children -- to-many relationship does not have an inverse: (From: Ignacio Enriquez <email@hidden>)

  • Prev by Date: Re: Threading and Event Queue Question
  • Next by Date: Re: override hyperlink handler for WebView
  • Previous by thread: CoreData warning: File.children -- to-many relationship does not have an inverse:
  • Next by thread: Threading and Event Queue Question
  • Index(es):
    • Date
    • Thread