NSPredicate get entities with attribute not in a given array
<p>I am using CloudKit to store and sync some data in my app. Let's say I have a record type with an attribute named <code>key</code>. I want to fetch all records with <code>key</code> not in a given array <code>unwantedKeyArray</code>.</p>

<p>I tried </p>

<pre><code>let predicate = NSPredicate(format: "key NOT IN %@", unwantedKeyArray)
</code></pre>

<p>But the app crashed with error saying </p>

<blockquote>
  <p>'Unable to parse the format string "key NOT IN %@"'</p>
</blockquote>

<p>So what's the correct way to create a <code>NSPredicate</code> to achieve my goal? </p>

<p>(Although I use Swift in my app and in this question description, answers in ObjC are also welcome)</p>