title: Swift: CoreData - unrecognized selector sent to instance when insert row
body: <p>This error is strange:</p>
  
  <pre><code>-[&lt;&gt;.Tips setTipName:]: unrecognized selector sent to instance &lt;&gt;
  </code></pre>
  
  <p>the name setTipName does not occur anywhere in the code but there is a variable tipName (note the lower case "t"</p>
  
  <p>I am attempting to insert a row into a CoreData entity</p>
  
  <pre><code>class Tips: NSManagedObject {
  @NSManaged var sectionNumber: NSNumber
  @NSManaged var tipDescription: String
  @NSManaged var viewName: String
  @NSManaged var tipName: String
  @NSManaged var tipOrder: NSNumber
  @NSManaged var tipType: String
  @NSManaged var tipLinkName: String
  }
  </code></pre>
  
  <p>Here is the code doing the insert:</p>
  
  <pre><code>func createNewTips ()
  {
      //  set create all switches and set to off
      var error: NSError? = nil
      var textCount = textArray.count
      for var i = 0; i&lt;textCount; ++i
       {
          var newTip = NSEntityDescription.insertNewObjectForEntityForName("Tips", inManagedObjectContext: managedObjectContext!) as! Tips
          newTip.viewName    = viewName
          newTip.tipName = textArray [i].tipName
        NSLog("after tipName")
          newTip.tipDescription = textArray[i].tipDescription
          NSLog("after set tipDescription")
          newTip.tipOrder = textArray[i].tipOrder
          NSLog("after set tipOrder")
          newTip.sectionNumber = textArray[i].sectionNumber
          NSLog("after set sectionNumber")
          newTip.tipType = textArray[i].type
          NSLog("after set type")
          newTip.tipLinkName = textArray[i].tipLinkName
          var error: NSError? = nil
          if !managedObjectContext!.save(&amp;error) {
              NSLog("error &amp;d", error!)
              abort()
          } // end save
  
      } // end loop
  
  } // end of createNewSwitches
  </code></pre>
  
  <p>I've recreated the data model several times</p>
  
  <p>I've also changed the order of the attributes and the error occurs on a different attribute .. I've noticed that it appears to be the first attribute when I move the viewName attribute later in the list.</p>
  
  <p>Here is the code in textArray  </p>
  
  <pre><code>   var textArray:[(sectionNumber: Int, tipOrder: Int, tipName: String, tipDescription: String, type: String, tipLinkName:String)] =
  [
      (1,0,"sw1","Check in and around your home for damage","text",""),
      (1,1,"sw2","Dispose of any spoiled or contaminated foods, especially after a power outage. If you’re not sure, throw it out. You can check the food safety tips below","text",""),
      (1,2,"sw3","Encourage family members to talk about their experience and their feelings, especially children","text",""),
      (1,3,"sw4","Contact other family members to let them know that you are safe","text",""),
      (2,0,"sw5","Check Utilities","link",""),
      (3,0,"sw6","Food Safety Tips","link",""),
  ]
  </code></pre>
  
  <p>Any suggestions about this? </p>