title: Swift: Unacceptable type of value for attribute when creating new NSEntity
body: <p>I have a Core Data entity set up with the following attributes:</p>
  
  <pre><code>resellerNo:Int
  resellerName:String
  </code></pre>
  
  <p>I have setup an NSManagedObject as follows:</p>
  
  <pre><code>class Reseller: NSManagedObject
  {
      @NSManaged var resellerNo: Int
      @NSManaged var resellerName: String
  }
  </code></pre>
  
  <p>If I try to run this method:</p>
  
  <pre><code>func createNewReseller(resellerName: String)
  {
      let context = app.managedObjectContext
  
      let resellerEntity = NSEntityDescription.entityForName("Resellers", inManagedObjectContext: context)
      let newReseller = Reseller(entity: resellerEntity!, insertIntoManagedObjectContext: context)
  
      newReseller.resellerNo = 12
      newReseller.resellerName = resellerName
      saveDatabase()
      Swift.print ("Reseller \(resellerName) created")
  }
  </code></pre>
  
  <p>then it crashes when trying to allocate the resellerNo with an error message: </p>
  
  <blockquote>
    <p>Unacceptable type of value for attribute: property = "resellerNo";
    desired type = NSNumber; given type = __NSTaggedDate; value =
    2001-01-01 00:00:00 +0000.</p>
  </blockquote>
  
  <p>Strange thing is, if you use the console to print <code>newReseller.resellerNo</code> just beforehand then it works fine.</p>
  
  <p>Other code accessing other Entities in exactly the same way work fine.</p>
  
  <p>Any ideas?</p>