title: How to write a BOOL predicate in Core Data?
body: <p>I have an attribute of type <code>BOOL</code> and I want to perform a search for all managed objects where this attribute is <code>YES</code>.</p>
  
  <p>For string attributes it is straightforward. I create a predicate like this:</p>
  
  <pre><code>NSPredicate *predicate = [NSPredicate predicateWithFormat:@"userName = %@", userName];
  </code></pre>
  
  <p>But how do I do this, if I have a bool attribute called <em>selected</em> and I want to make a predicate for this? Could I just do something like this?</p>
  
  <pre><code>NSPredicate *predicate = [NSPredicate predicateWithFormat:@"selected = %@", yesNumber];
  </code></pre>
  
  <p>Or do I need other format specifiers and just pass <code>YES</code>?</p>