On 7/17/12 11:41 PM, Markus Spoettl wrote:
   I have an NSArrayController (automaticallyRearrangesObjects = YES) on which I
set a filterPredicate in code (not through bindings). Most of the time,
rearranging works but in one 100% reproducible case, the controller produces an
empty arrangedObjects array when it should produce a non-empty one.

It always happens if a certain predicate (A) was set before the predicate that
produces the wrong result (B) is set. If any another predicate (or none) is set
when setting (B), arrangedObjects is correctly populated. This is completely
reproducible.

And I now have a surprisingly small test project the does it as well, here's the source:

http://www.shiftoption.com/temp/filtering.zip

I started removing big portions of my app in order to rule out side effects of potential memory corruption elsewhere (you never know). Then I decided to try set up at simple test project from scratch, and what do you know, against all odds it worked (meaning of course it fails too).

To recreate it, compile and run:

Press Buttons in sequence

 1: shows "Power"
 2: shows nothing
 3: shows: "Roller Biking"
 2: shows "Power Boating" (should have shown that with the first press)

I also looked at the predicate operator type as a potential source of the issue but I can't see a problem there. I'm using NSEqualToPredicateOperatorType is fine, as I do want a comparison using -equalTo: . NSMatchesPredicateOperatorType produces the correct result

I'd be delighted if someone told me it's all my fault. Can anyone point out the error?

Thanks!
Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________

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