title: How to create a Core Data predicate to test that a relation contains all given objects?
body: <p>Setup:</p>
  
  <p>I have a Core Data object A that has a to-many relation to B. Call the relation "items". So, a.items returns all B-s associated with A.</p>
  
  <p>Now, I have a manually composed NSSet "itemSet" of B objects.</p>
  
  <p>I want to do the following:</p>
  
  <pre><code>return all A objects whose "items" relation exactly matches itemSet
  </code></pre>
  
  <p>How do I construct a predicate for that? I’ve tried this:</p>
  
  <pre><code>NSPredicate *predicate = [NSPredicate predicateWithFormat:
                            @"(ALL items in %@)", itemSet];
  </code></pre>
  
  <p>But that just gives me <code>Unsupported predicate (null)</code>.</p>
  
  <p>This:</p>
  
  <pre><code>NSPredicate *predicate = [NSPredicate predicateWithFormat:
                            @"(items in %@)", itemSet];
  </code></pre>
  
  <p>tells me <code>unimplemented SQL generation for predicate</code>. Interesting, but not helpful.</p>
  
  <p>So what’s the right way to filter the relation with a set?</p>