无法在第三次Core Data迁移

时间:2017-01-03 14:07:39

标签: swift core-data

我做了3个版本的数据模型:

enter image description here

我更改了名称 solutis应该是solutis 2 solutis 2应该是solutis ......

Solutis 2:

enter image description here

Solutis:

enter image description here xmlSendLead:重命名ID = xml

Solutis 3:

enter image description here statutSendSimulation:重命名ID = statutEnvoieSendSimulation

statutSendLead:重命名ID = statutEnvoieSendLead

dateSendSimulation:重命名ID = dateEnvoieSendSimulation

dateSendLead:重命名ID = dateEnvoieSendLead

但是当我从之前的版本迁移到最后一个版本时,我无法检索到xmlSendLead ...

我刚刚在进行应用更新之前添加了数据,我在第一页上打印了一个数据:

            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)
            }

results:item.id:Optional(1),item.statutSendLead:Optional(1),item.dateSendLead:Optional(2017-01-03 12:56:27 +0000), item.xmlSendLead: nil ,item.contactWebId:Optional(120000139),item.statutSendSimulation:Optional(1),item.dateSendSimulation:Optional(2017-01-03 12:56:29 +0000),item.xmlSendSimulation:Optional( &#34; ...&GT;&#34)

0 个答案:

没有答案