Post

Replies

Boosts

Views

Activity

Reply to SwiftData & CloudKit: Arrays of Codable Structs Causing NSKeyedUnarchiveFromData Error
@anol1258 I was getting the same error when testing on the physical device. Then I saw @DTS Engineer's reply where they usevar timesData: Data? = nil and it got me thinking that the problem might be that the you are using an optional Data? type and then setting the value to self.times = times I suspect that the warning is occurring because there are existing records in the database with data stored in that field. On mine, I had a "data" property being initialized like this: data: Data = Data() (an empty Data object)... I then changed my init() to set the initial value to = nil. And just like that, no more NSKeyedUnarchiveFromData error. Hope that helped.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
2w