I have an Entity named Skeins that appears to be losing two of the attributes and I can't work out why:
func insertSkein(brand: String, code: String, type: String, description: String, discontinued: Bool) throws {
let sk = Skeins(context: self.context)
sk.id = UUID()
sk.brand = brand
sk.code = code
sk.type = type.capitalized
sk.skeindesc = description.capitalized
sk.discontinued = discontinued
self.context.insert(sk)
do{
try self.context.save()
}
catch{
print("error inserting skein: \(error)")
}
}
If I look at the state of sk at the insert line I can see:
<Skeins: 0x600002ba1e00> (entity: Skeins; id: 0x6000008ab100 <x-coredata:///Skeins/t9792D8DC-F6B0-4644-BD81-4CC63CE05B0F2>; data: {
brand = TestBrand;
brandcode = TestBrandTestCode;
code = TestCode;
discontinued = 0;
id = "F1C7929C-C271-477D-B12F-0B3A11C13008";
projectSkeins = (
);
sharedSkeinProjects = (
);
As you can see both skeindesc and type are missing (both definitely have values in the parameters) and I can't find any difference in the way the strings are defined in the database file, so I'm stuck! Any suggestions would be brilliant :)
Thanks, Becky
Thanks everyone for the comments on this - spent a few days getting frustrated with it and then randomly chose a different emulator and it worked fine. So best guess is that when I changed pointing the project at iOS 14 -> iOS 15 the emulator got all confused. Lesson learnt - always wipe the emulator if I'm making big project changes!