title: Fetch Request: error . . . Core Data Swift 3
body: <p>Good Night; </p>
  
  <p>Im creating an app that would save the name of people in a Core Data file, when I run the app and save what the user typed it works fine when I load (fetch ) the data it also works fine, the problem comes when I close or go to a different view controller when I hit the load data(fetch) the app crashed with : 'NSInvalidArgumentException', 
  reason: 'executeFetchRequest:error: 
   is not a valid NSFetchRequest.'</p>
  
  <p>this is my code </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> @IBOutlet var PresidentTxt: UITextField!
      
      @IBOutlet var SecDefenseTxt: UITextField!
    
      
      let dataStack = CoreDataStack()
      
      
      
      override func viewDidLoad() {
          super.viewDidLoad()
  
          
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
      
      
      
      @IBAction func Save(_ sender: Any) {
      
     
          
          
          let database = dataStack.persistenContainer.viewContext
          
          let dbrRecord = Command(context: database)
          
          dbrRecord.potus = PresidentTxt.text
          dbrRecord.defsec = SecDefenseTxt.text
          
          do{
          
          try database.save()
          
          
          }catch {}
          
          
          
          
          
      }
      
      func didTapView(){
          self.view.endEditing(true)
      }
      
      
      @IBAction func Load(_ sender: Any) {
     
     
          
          let database = dataStack.persistenContainer.viewContext
          
          do{
              
              let results = try database.fetch(Command.fetchRequest()) as! [Command]
              
              for presidentUS in results{
                  if let _ = presidentUS.potus {
                  
                      PresidentTxt.text = presidentUS.potus
                      
                  }
              
              }
              
              for DefenseSec in results {
              
                  if let _ = DefenseSec.defsec {
                  
                      SecDefenseTxt.text = DefenseSec.defsec
                  
                  }
              
                  
                  
                  
                  
                  
              }
          
          
          
          
          
          
          }catch {}
     
          
  
      }</code></pre>
  </div>
  </div>
  </p>