I am using SwiftData for my model. Until Xcode 15 beta 4 I did not have issues. Since beta 5 I am receiving the following red warning multiple times: 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release This seems to be a CoreData warning. However, I am not using CoreData directly. I have no way to change the config of CoreData as used by SwiftData. My model just uses UUID, Int, String, Double, some of them as optionals or Arrays. I only use one attribute (.unique).
SwiftData error: NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
I also have this issue. I'm hoping it's a bug that the SwiftData team is planning to fix before release. If not, hopefully Apple releases some guidance for how to resolve this error. In the meantime, I'm ignoring it and hoping for the best.
Apparently this has been fixed in Xcode 15 beta 7
This is still an issue for me in Xcode 15 RC.
Below is an example of the transformer I'm using for saving a UIColor
final class ColorValueTransformer: NSSecureUnarchiveFromDataTransformer {
static let name = NSValueTransformerName(rawValue: String(describing: ColorValueTransformer.self))
override static var allowedTopLevelClasses: [AnyClass] {
return [UIColor.self]
}
public static func register() {
let transformer = ColorValueTransformer()
ValueTransformer.setValueTransformer(transformer, forName: name)
}
}
Same issue with my transformable array of strings in Xcode 15.2 and iOS 17.3. I'm switching from CoreData to SwiftData and using NSSecureUnarchiveFromData. But still get this error and then the app crashes due to memory. Frustrating I can't move to SwiftData after all of the work I put into changing my code. Good thing I saved a copy of the CoreData version.
I still get this in Xcode 16b5 on macOS in my SwiftData/SwiftUI app. I don't explicitly use NSKeyedArchiver anywhere, nor do I have any transformations on my model objects.