Doh! I must not have had my afternoon hit of caffeine. I was still
using fetch: instead of fetchWithRequest:merge:error: for the object
controller which caused the contentSet to be nil (and thus the
selection to be wiped out) until the fetch was sent the next time
around the run loop.
--
Michael
On Aug 30, 2008, at 10:00 PM, Michael Link wrote:
I have a situation where I have a source list whose selection
controls the bindings of an NSArrayController, and thus the content
of a view. Depending on what source a user selects in the source
list the NSArrayController can have its MOC bound and a fetch
predicate set or its contentSet bound to an NSObjectController who
is bound to the MOC with a fetch predicate set (ideally I'd be using
strictly fetch predicates which would solve this problem, but it
seems that binding the array controller to the object controller and
setting the contentSet key path to selection.toManyRelationship is *
faster than the equivalent fetch predicate even though it does the
same thing).
When the source list selection is changed so that the array
controllers bindings are changed from contentSet to MOC then the
array controller does preserve the selection.
If the array controllers bindings are changed from a MOC to a
contentSet the array controller doesn't seem to preserve the
selection even though the new content also contains objects that
were in the selection. I'd like to find a way that the selection can
be preserved with this change, if possible?