title: Using NSPredicate to filter an NSArray based on NSDictionary keys
body: <p>I have an array of dictionaries.</p>
  
  <p>I want to filter the array based on a key.</p>
  
  <p>I tried this:</p>
  
  <pre><code>NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(SPORT ==  %@)", @"Football"];
  
  NSArray *filteredArray = [data filteredArrayUsingPredicate:predicate];
  </code></pre>
  
  <p>This doesn't work, I get no results. I think I'm doing something wrong. I know this is the method if "SPORT" was an ivar. I think it is probably different if it is a key.</p>
  
  <p>I haven't been able to find an example however.</p>
  
  <p>Thanks</p>
  
  <hr>
  
  <p><strong>Update</strong></p>
  
  <p>I added quotes around the string I am searching for.</p>
  
  <pre><code>NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(SPORT ==  '%@')", @"Football"];
  </code></pre>
  
  <p>It still does not work.</p>
  
  <hr>
  
  <p><strong>Update 2</strong></p>
  
  <p>Solved it. I actually had to remove the single quotes, which seems to go against what the guide says.</p>
  
  <p>My real problem is I had a nested array and I wasn't actually evaluating the dictionaries. Bone head move.</p>