title: Save custom objects into NSUserDefaults
body: <p>I'm having a news <code>ViewController</code> and a <code>TeamViewController</code>. The <code>TeamViewController</code> contain a tableView of teamObjects which when selected is added into array. I want to add this array into <code>NSUserDefaults</code> so i can access them from the <code>NewsController</code> which contain a url request where the teamObjects is needed. However i keep getting:</p>
  
  <blockquote>
    <p>'Attempt to insert non-property list object (
          ""
       ) for key teams'</p>
  </blockquote>
  
  <p>I'm open for other suggestions if there is better ways than storing it in <code>NSUserDefaults</code></p>
  
  <p><code>didSelectRowAtIndexPath</code> method</p>
  
  <pre><code>override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
      tableView.deselectRowAtIndexPath(indexPath, animated: true)
  
  
      let team = self.teamArray[indexPath.row] as Team
      var removed = false
  
      for (index, value) in enumerate(self.teamSelected) {
          if (value == team) {
              self.teamSelected.removeAtIndex(index)
              removed = true
          }
      }
  
      if (!removed) {
          self.teamSelected.append(team)
      }
  
      var userDefaults = NSUserDefaults.standardUserDefaults()
      userDefaults.setValue(self.teamSelected, forKey: "teams")
      userDefaults.synchronize()
  
      tableView.reloadData()
  }
  </code></pre>
  
  <p>My object</p>
  
  <pre><code>class Team: NSObject{
      var id: Int!
      var name: NSString!
      var shortname: NSString!
  
  
      init(id: Int, name:NSString, shortname: NSString) {
          self.id = id
          self.name = name
          self.shortname = shortname
  
      }
  
  }
  </code></pre>