title: Core Data NSEntityDescription.entityForName returns nil, but managedObjectModel.entities lists the entities
body: <p>I'm trying to create a subclass of NSManagedObject in swift.  I have created two entities called Pages and Book in the model editor and generated their class files.  Here are the two classes:</p>
  
  <pre><code>@objc(Pages)
  class Pages: NSManagedObject {
  
      @NSManaged var pageNo: NSNumber
  
  }
  
  @objc(Book)
  class Book: NSManagedObject {
  
      @NSManaged var pageCount: NSNumber
      @NSManaged var title: String
      @NSManaged var fetchLastPage: [Pages]
  
  }
  </code></pre>
  
  <p>As a test to create an Instance of Pages I wrote this code in ViewDidLoad which failed because it couldn't find the entity in the model:</p>
  
  <pre><code>    let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
  
      let managedContext = appDelegate.managedObjectContext!
  
      var pages = NSEntityDescription.insertNewObjectForEntityForName("StoreTest.Pages", inManagedObjectContext: managedContext)
  </code></pre>
  
  <p>'StoreTest' is the name of my application which is also set in the model editor for the two entities.  To see what's going on I added this code before creating the instance:</p>
  
  <pre><code>    var pagesEntity = NSEntityDescription.entityForName("StoreTest.Pages", inManagedObjectContext: managedContext)
      println("pagesEntity = \(pagesEntity)")
  
      var ents = managedContext.persistentStoreCoordinator!.managedObjectModel.entities
      println("entities = \(ents)")
  </code></pre>
  
  <p>The NSEntityDescription.entityForName call returns nil, but the call to managedObjectModel.entities returns the two entities.  </p>
  
  <p>I made sure there's no spelling problem.  Also, the managedObject is not nil.  The target of my data model file is correctly set to my app module.</p>
  
  <p>I'm using xCode 6.4.  </p>
  
  <p>Thanks for your help!</p>