On 11 Nov 2012, at 4:30 PM, Erik Stainsby <[email protected]> wrote:

> in spite of having 51 records which have firstName values…  And regardless of 
> the number of matches which it ought to be generating it returns exactly one 
> result each time.

The array is built up as a side effect of -[NSArray indexOfObjectPassingTest:]. 
The block that implements the test returns YES when the firstName matches.

Reflect that a method that searches for the index (singular) of a member of an 
array will stop searching when it finds the object. (Why is it always in the 
last place you look?) That is, it stops as soon as you return YES, upon the 
first match.

Your example doesn't use the index indexOfObjectPassingTest: returns. Why do 
you not want to use -enumerateObjectsUsinghBlock:?

Or, you could use index_es_OfObject_s_PassingTest: and objectsAtIndexes:.

>  (And btw, is it legit to NSLog() from inside a block ?)

Yes.

        — F


_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to