Use a simple for-in NSMutableArray , NSMutableArray builder, and -[NSPredicate evaluateWithObject:] .
NSMutableArray *builder = [NSMutableArray arrayWithCapacity:50]; for (id object in array) { if ([predicate evaluateWithObject:object]) { [builder addObject:object]; if (builder.count >= 50) break; } }
I noticed that you noted the question of Core Data . If you can use NSFetchRequest , just set its fetchLimit to 50.
source share