title: Objective-C: Set boolean value in core data
body: <p>In my data model, in an entity, I have an attribute that is a boolean.  In the xcmodeldatad file, it is listed as:</p>
  
  <p><code>need sync Boolean.</code>  In the NSmanagedobject file it is as follows:</p>
  
  <pre><code>.h file: @property (nonatomic, strong) NSNumber *needsync;//bool
  .m file @dynamic needsync;
  </code></pre>
  
  <p>When saving the record after an edit, I use the following code that I have used numerous times before:</p>
  
  <p>[list setValue:@0 forKey:@"needsync"];</p>
  
  <p>However, it is throwing an exception when it reaches this line of </p>
  
  <pre><code>NSUnknownKeyException', reason: '[&lt;__NSCFString 0x17409c4d0&gt; setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key need sync.'
  </code></pre>
  
  <p>This is really baffling me and I wonder if anyone can spot error or has had this happen before.</p>
  
  <p>Thank you.</p>