• 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: Adding records to a child entity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Adding records to a child entity


  • Subject: RE: Adding records to a child entity
  • From: "Jon C. Munson II" <email@hidden>
  • Date: Wed, 13 May 2009 16:09:23 -0400
  • Organization: JTA Enterprises LLC

Namaste!

OK, I solved this one.

The issue is that I have to use a different MOC from the NSApp Delegate's
MOC.

Because of that, the object was in a different MOC than expected and thus
the error.

Fetching the object out of the needed MOC solves the issue.

Peace, Love, and Light,

/s/ Jon C. Munson II

> -----Original Message-----
> From: cocoa-dev-bounces+jmunson=email@hidden [mailto:cocoa-dev-
> bounces+jmunson=email@hidden] On Behalf Of Jon C. Munson II
> Sent: Wednesday, May 13, 2009 10:55 AM
> To: email@hidden
> Subject: RE: Adding records to a child entity
>
> Namaste!
>
> Well, since no-one has answered this (don't know if more info is needed),
> let me phrase this a different way.
>
> There are two entities, A, and B.  A has a to-many relationship with B.
> For
> the sake of discussion, I'll call the inverse relationship relA (which is
> an
> attribute of entity B).
>
> A window is built to act as a form for data entry for A.  This is
> accomplished one record at a time (regular form view).  Entity B is
> presented as a tableview on the form for A.  Fairly standard arrangement.
>
> Two array controllers are present to back the form and the tableview.
>
> Now, files are to be dropped on the form to create records in B and thus
> associated with A.  I'm using the managedObjectContext to accomplish this
> and not adding via the array controller(s).
>
> When one goes to programmatically add B objects, what is the proper way to
> set relA for a new entity B?
>
>      newEntityB.relA = ?
>
> With the knowledge I've got, I tried a few things and didn't get anywhere.
> The code stops on a call to:
>
>      _PFManagedObject_coerceValueForKeyWithDescription
>
> This results in an objc_exception_throw error.  Going up the stack gets
> back
> to the line around which this question revolves.
>
> I am attempting to get the current A out of the backing array controller,
> and I suspect it isn't returning the "true" object.  This is the line of
> code cited in the OP.
>
> Now, I have a drop operation in another form where I programmatically add
> both A and B and don't have an issue there.  I believe because A is
> created
> at that moment and is therefore "true."
>
> My guess is there's something about the object (the term "proxy" is coming
> to mind) that isn't quite right or needs to be transformed/cast somehow...
>
> Again, any help/input appreciated.
>
> Thanks!
>
> Peace, Love, and Light,
>
> /s/ Jon C. Munson II
>
> > -----Original Message-----
> > From: cocoa-dev-bounces+jmunson=email@hidden [mailto:cocoa-
> dev-
> > bounces+jmunson=email@hidden] On Behalf Of email@hidden
> > Sent: Tuesday, May 12, 2009 9:24 PM
> > To: email@hidden
> > Subject: Adding records to a child entity
> >
> > Namaste!
> >
> > I'm having a wee bit of difficulty adding records to a child entity.
> >
> > The situation is this:  I'm implementing drag-n-drop of files onto a
> > tableview I have on a window.  The tableview holds a list of files
> > that are related to the parent record.
> >
> > My program chokes on the line where I set the relationship:
> >
> >       newFileItem.relPattern = [[acPattern selectedObjects]
> > objectAtIndex:0];
> >
> > There is no error text in the console, and the code dies somewhere in
> > the core data stuff (I assume) as going up the call stack drops me on
> > that line.  I am guessing the call to retrieve the current parent
> > record isn't returning the correct object.  However, I'm not sure how
> > to get around this.
> >
> > As a secondary question, I wasn't able to specifically get the
> > tableview to accept the drop - only the main window.  Is there any way
> > to achieve that behavior solely for the tableview, or is registering
> > the window the only way?
> >
> > Any help is greatly appreciated.
> >
> > Thanks!
> >
> > Peace, Love, and Light,
> >
> > /s/ Jon C. Munson II
> >
> > _______________________________________________
> >
> > 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
>
> _______________________________________________
>
> 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

_______________________________________________

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: 
 >Adding records to a child entity (From: email@hidden)
 >RE: Adding records to a child entity (From: "Jon C. Munson II" <email@hidden>)

  • Prev by Date: Getting "Unknown class 'someClassName' in nib file" message
  • Next by Date: Menu item and state
  • Previous by thread: RE: Adding records to a child entity
  • Next by thread: Text encoding issues
  • Index(es):
    • Date
    • Thread