Filter an NSArray of NSDictionary with NSPredicate

priore Jan 23rd, 2014 441 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. NSPredicate *filter = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
  2.         return [[evaluatedObject valueForKeyPath:@"activity.object.type"]
  3.                 isEqualToString:@"FILTER-TEXT-VALUE"];
  4. }];
  5. NSArray *new_array = [you-array filteredArrayUsingPredicate:filter];
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand