title: Error with Swift and Core Data: fatal error: use of unimplemented initializer 'init(entity:insertIntoManagedObjectContext:)'
body: <p>I have the following class that inherits from <code>NSManagedObject</code>:</p>
  
  <pre><code>import Foundation
  import CoreData
  
  
  class Note: NSManagedObject {
  
  
  
      @NSManaged var text: String
      @NSManaged var name: String
  
  
       init(name: String, text:String, context: NSManagedObjectContext){
  
          let entity = NSEntityDescription.entityForName("Note", inManagedObjectContext: context);
          super.init(entity: entity!, insertIntoManagedObjectContext: context)
  
          self.text = text
          self.name = name;
  
      }
  }
  </code></pre>
  
  <p>When I create instances of it, everything works fine, but when I make a search for these entities, I get a very odd error:</p>
  
  <pre><code>fatal error: use of unimplemented initializer 'init(entity:insertIntoManagedObjectContext:)'
  </code></pre>
  
  <p>This is the code that causes the error:</p>
  
  <pre><code>func coreDatePlayground(){
  
      var note = Note(name: "A new note", text: "blah", context: self.managedObjectContext!)
  
      println("\(note.name)  \(note.text)")
  
      var noote2 = Note(name: "Another note", text: "blah blah", context: self.managedObjectContext!)
  
  
      managedObjectContext?.save(nil)
  
      var fetch = NSFetchRequest(entityName: "Note")
      // This line causes the crash.
      var results = self.managedObjectContext?.executeFetchRequest(fetch, error: nil)
      if let objects = results{
          println(objects.count)
      }
  
  }
  </code></pre>
  
  <p>I found out that changing the initialiser by making it a convenience one and calling on self instead of on super gets rid of the issue, but I have no idea why.</p>
  
  <pre><code> convenience init(name: String, text:String, context: NSManagedObjectContext){
  
      let entity = NSEntityDescription.entityForName("Note", inManagedObjectContext: context);
      self.init(entity: entity!, insertIntoManagedObjectContext: context)
  
      self.text = text
      self.name = name;
  
  }
  </code></pre>
  
  <p>The code above works, but I have no idea why. Anybody knows what's going on? Is it a bug or is my fault?</p>