Swift Can';t在第三次核心数据迁移时检索值
我做了3个版本的数据模型: 我更改了名称solutis应该是solutis 2和solutis 2应该是solutis 解决方案2: 溶质: xmlSendLead:重命名ID=xml 第3条: StateTSendSimulation:重命名ID=StateTenVoieSendSimulation statutSendLead:Renaming ID=stattenvoiesendlead dateSendSimulation:重命名ID=dateEnvoieSendSimulation dateSendLead:重命名ID=dateEnvoieSendLead 但是当我从上一个版本迁移到最后一个版本时,我无法检索xmlSendLead 在进行应用程序更新之前,我刚刚添加了一个数据,我在第一页进行了打印:Swift Can';t在第三次核心数据迁移时检索值,swift,core-data,Swift,Core Data,我做了3个版本的数据模型: 我更改了名称solutis应该是solutis 2和solutis 2应该是solutis 解决方案2: 溶质: xmlSendLead:重命名ID=xml 第3条: StateTSendSimulation:重命名ID=StateTenVoieSendSimulation statutSendLead:Renaming ID=stattenvoiesendlead dateSendSimulation:重命名ID=dateEnvoieSendSimulati
do {
if #available(iOS 10.0, *) {
request = Leads.fetchRequest()
} else {
request = NSFetchRequest<NSFetchRequestResult>(entityName: "Leads")
}
let results = try context.fetch(request)
if results.count > 0 {
for item in results as! [Leads]{
print("results : item.id:\(item.id), item.statutSendLead:\(item.statutSendLead), item.dateSendLead:\(item.dateSendLead), item.xmlSendLead:\(item.xmlSendLead), item.contactWebId:\(item.contactWebId), item.statutSendSimulation:\(item.statutSendSimulation), item.dateSendSimulation:\(item.dateSendSimulation), item.xmlSendSimulation:\(item.xmlSendSimulation)")
}
}
} catch {
print(error)
}
do{
如果可用(iOS 10.0,*){
request=Leads.fetchRequest()
}否则{
request=NSFetchRequest(entityName:“Leads”)
}
let results=try context.fetch(请求)
如果results.count>0{
结果中的项目为![潜在客户]{
打印(“结果:item.id:\(item.id)、item.statutSendLead:\(item.statutSendLead)、item.dateSendLead:\(item.dateSendLead)、item.xmlSendLead:\(item.contactWebId)、item.statutSendSimulation:\(item.statutSendSimulation)、item.dateSendSimulation:\(item.dateSendSimulation)、item.xmlSendSimulation:\(项目.模拟)”)
}
}
}抓住{
打印(错误)
}
结果:item.id:Optional(1),item.statutSendLead:Optional(1),item.dateSendLead:Optional(2017-01-03 12:56:27+0000),item.xmlssendLead:nil,item.contactWebId:Optional(120000139),item.statutSendSimulation:Optional(1),item.dateSendSimulation:Optional(2017-01-03 12:56:29+0000),item.xmlssendSimulation:Optional(“…>”)