title: NSPredicate on an NSArray to search for any object
body: <p>I have an array of objects with names, addresses, tel. nos, etc.</p>
  
  <p>I want to be able to search the array for any occurrence of a term - whether in the name field, the address field, etc.</p>
  
  <p>I have something like this in mind :</p>
  
  <pre><code>-(void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope {
      // Update the filtered array based on the search text and scope.
      // Remove all objects from the filtered search array
  
  
      [self.searchResults removeAllObjects];
      // Filter the array using NSPredicate
      NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF contains[c] %@",searchText];
      searchResults = [NSMutableArray arrayWithArray:[contactArray filteredArrayUsingPredicate:predicate]];
  }
  </code></pre>
  
  <p>This causes an exception "Can't use in/contains operator with collection".</p>
  
  <p>UPDATE. I can now search on up to three fields. When I add a fourth (in any sequence), I get this exception: "Unable to parse the format string ..."</p>
  
  <p>The Predicate code is now:</p>
  
  <pre><code>NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF.narrative contains[c] %@ OR SELF.category contains[c] %@ OR SELF.date contains[c] OR SELF.name contains[c] %@", searchText, searchText, searchText, searchText];
  
       searchResults = [NSMutableArray arrayWithArray:[allDreams filteredArrayUsingPredicate:predicate]];
  </code></pre>
  
  <p>Is three a limit of predicate search fields? How do I get around this? Thanks again.</p>