title: I'm getting this error in Swift 'NSInvalidArgumentException'
body: <p>'NSInvalidArgumentException', reason: 'Unacceptable type of value for attribute: property = "save1D"; desired type = NSData; given type = Swift.__SwiftDeferredNSArray;</p>
  
  <p>I've been stuck on this a few days now. I'm trying to save to and load from core data. I'm trying to save arrays from a collection view into a tableview then reload them back into a collection view. I've not been able to find a solution that fits what I need. I'm sure I'm missing something obvious but I can't se it. Can anyone help me with this?</p>
  
  <pre><code> @IBAction func saveData(_ sender: Any) {
          let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
          let entity = NSEntityDescription.entity(forEntityName: "TextSave", in: context)
          let textEntity = NSManagedObject(entity: entity!, insertInto: context)
  
          textEntity.setValue(v1, forKey: "save1D")
          textEntity.setValue(i1, forKey: "save2D")
          textEntity.setValue(ImageView, forKey: "picCock")
  
          do {
              try context.save()
              print("saved")
  
          } catch {
              print("failed save")
          }
          }
     func getData() {
              let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
               let request = NSFetchRequest&lt;NSFetchRequestResult&gt;(entityName: "TextSave")
               request.returnsObjectsAsFaults = false
  
               do {
                   let result = try context.fetch(request)
                   for data in result as! [NSManagedObject]
                   {
                      v1 = data.value(forKey: "save1D") as! [String]
                      i1 = data.value(forKey: "save2D") as! [String]
                       ImageView = (data.value(forKey: "picCock") as! UIImageView)
                   }
               } catch {
                   print("failed")
               }
               }
  </code></pre>