One thing you are missing, is that, as far as I know, the generated
accessors are still broken.  You have to write your own.  I did find a set
of macros someone wrote for this, but haven¹t tried them yet because I had
already written many of my own sets of accessors.

Two more things to watch out for (been bitten by both):

1. Note that [(NSOrderedSet) array] does not return a new array.  If you
change the orderedSet, it will change the returned array.  It is a
³representation² of the orderedSet as an array, not a new array.

    2.  moveObjectsFromIndexes:toIndex does not work in the way you might
expect, like moving table elements to the dropped index location.  No way,
no how. You have to first figure out what the new insert index will be after
removing the objects, because that is what this routine expects as its index
input.  I¹ve filed bug reports on this, but they haven¹t updated it.  The
(prigrammer) user should not have to know how this routine works internally
in order to use it properly.  It should work the way it is displayed in a
table, so the index should be the row number where you dropped it in the
table.

Message: 1 Date: Mon, 31 Mar 2014 09:32:50 -0500 From: Fritz Anderson
<fri...@manoverboard.org> To: Rick Mann <rm...@latencyzero.com> Cc: Cocoa
dev <cocoa-dev@lists.apple.com> Subject: Re: Ordered to-many relationship
CoreDataGeneratedAccessors Message-ID:
<ccc92aa3-1729-48b6-bfeb-5bcc878a6...@manoverboard.org> Content-Type:
text/plain; charset=windows-1252 On 29 Mar 2014, at 3:11 AM, Rick Mann
<rm...@latencyzero.com> wrote: > I'm getting > >    -[WireSegment
replaceObjectInNodesAtIndex:withObject:]: unrecognized selector sent to
instance > > When I try to send that message. This is one of the
"CoreDataGeneratedAccessors", for an ordered to-many relationship. I don't
see anything in the docs about those. What am I missing? > > -- > Rick I
assume "WireSegment" is an object variable despite the name. I believe that
what KVC is giving you for .nodes is an NSSet. What you want to do is
[[wireSegment mutableOrderedSetValueForKey: @"nodes"] replaceObjectAtIndex:
anIndex withObject: newObject]; Š which you¹d likely want to wrap in a
method of your own. I think. Written in Mail, uncompiled, untested.  ‹ F 

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to