input不匹配问题,同时添加到coredata数组
我已经在alertview文本字段中的数据添加到像这样的coredata的对象…
let category = Category(context: self.context) category.alertTextFieldData = (alertController.textFields?.first?.text)!
但是现在我想把这个添加到我正在尝试这样做的CoreData数组中…
self.people.append(category.alertTextFieldData!)
但是当我这样做,它会给出错误..
'Cannot convert value of type 'String' to expected argument type 'Category''
其中Category
是实体名称。
那我该如何解决这个问题呢?
replace这一行:
self.people.append(category)
从:
self.people.append(category.alertTextFieldData!)