Re: NSArrayController fetchPredicate behaving badly
Re: NSArrayController fetchPredicate behaving badly
- Subject: Re: NSArrayController fetchPredicate behaving badly
- From: Keary Suska <email@hidden>
- Date: Thu, 11 Sep 2008 11:42:40 -0600
- Thread-topic: NSArrayController fetchPredicate behaving badly
9/11/08 10:29 AM, also sprach email@hidden:
> I have two entities, "Reels" and "Scenes". Reels have many Scenes;
> reels have an "isHidden" attribute. The array controller I'm having
> trouble with fetches scenes that are in reels that are not hidden,
> thus it's fetch predicate (in IB, and I've done this programatically)
> is "reel.isHidden == NO".
>
> When I open a document, the ArrayController finds the correct scenes,
> the ones in unhidden reels. If I hide one reel and show another (by
> clicking checkboxes bound to the isHidden attribute on reels, the
> array controller persists in showing the scenes for the hidden reel
> (this is the problem). The array controller refuses to find the
> scenes in the unhidden reel no matter how many times I order it to
> fetch: or fetchWithRequest:
> UNTIL I save the document, at which time the array controller realizes
> what's been going on and fetches the correct scenes.
IIRC, this is expected behavior. Quirky, perhaps. What you probably want is
to apply the predicate also as a filter predicate. OTOH this should cause
the behavior you want
> Is my predicate right? I can't help thinking there's something goofy
> going on in my NSManagedObjectContext, something not being committed
> or updated or something.
No, I think it has to do with object caching, but don 't quote me on that
;-)
> On a side note, does anyone know why I can't see the fetchPredicate
> for an NSArrayController in the debugger? No such member seems to
> exist.
Why not? NSArrayController responds to -fetchPredicate. Shouldn't be any
problem there. Just po [arraycontroller fetchPredicate].
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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