title: iOS - Core data auto generated model - unrecognized selector
body: <p>I have a basic Core Data model which look like this :
  <img src="https://i.stack.imgur.com/u2ucj.png" alt="enter image description here"></p>
  
  <p>I auto-generated data model files and it's give me something like that :</p>
  
  <p>BSStudent.h</p>
  
  <pre><code>//
  //  BSStudent.h
  //
  
  #import &lt;Foundation/Foundation.h&gt;
  #import &lt;CoreData/CoreData.h&gt;
  
  @class BSFormation;
  
  @interface BSStudent : NSManagedObject
  
  @property (nonatomic, retain) NSString * firstname;
  @property (nonatomic, retain) NSString * lastname;
  @property (nonatomic, retain) NSDate * birthdate;
  @property (nonatomic, retain) id thumbnail;
  @property (nonatomic, retain) NSSet *formations;
  @end
  
  @interface BSStudent (CoreDataGeneratedAccessors)
  
  - (void)addFormationsObject:(BSFormation *)value;
  - (void)removeFormationsObject:(BSFormation *)value;
  - (void)addFormations:(NSSet *)values;
  - (void)removeFormations:(NSSet *)values;
  
  @end
  </code></pre>
  
  <p>BSStudent.m</p>
  
  <pre><code>//
  //  BSStudent.m
  //
  
  #import "BSStudent.h"
  #import "BSFormation.h"
  
  
  @implementation BSStudent
  
  @dynamic firstname;
  @dynamic lastname;
  @dynamic birthdate;
  @dynamic thumbnail;
  @dynamic formations;
  
  @end
  </code></pre>
  
  <p>I tried to simply save a BSStudent object by doing the following : </p>
  
  <pre><code>BSStudent *newStudent = (BSStudent *)[NSEntityDescription entityForName:kBSStudent inManagedObjectContext:self.managedObjectContext];
      newStudent.firstname = firstname;
      newStudent.lastname = lastname;
      newStudent.birthdate = birthdate;
      newStudent.thumbnail = thumbnail;
  
      NSError *error;
      if (![self.managedObjectContext save:&amp;error]) {
          NSLog(@"Error: %@", [error localizedDescription]);
      }
  </code></pre>
  
  <p>But my app always crash with error : <code>[NSEntityDescription setFirstname:]: unrecognized selector sent to instance 0x1f021e00</code></p>
  
  <p>Someone figuring out what's happening here ?</p>