'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release #358

Closed
opened 2025-12-29 15:29:57 +01:00 by adam · 8 comments
Owner

Originally created by @sebastien-tribu on GitHub (Feb 16, 2021).

Hi,

I recently herited a project for work which uses CoreStore. On launching the app on Simulator (but same warnings appear on device), the app will load data from using fetchOne, like so:

    func image(with id: String) throws -> Image? { // Image is autogenerated in Image+CoreDataClass.swift
        let image = try CoreStoreDefaults.dataStack.fetchOne(
            From<Image>()
                .where(\.id == id)
        )
        return image
    }

Here's the issue: every time that the data is loaded, a bunch of runtime warnings appear (i.e. one per loaded image in my use case.):

[general] 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
[general] 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
[general] 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
...
  1. According to this stackoverflow question, it could be caused by transformable attributes, but I don't even know where to start to debug this using CoreStore. How would you debug this in CoreStore?
  2. Do you know in which curcumstances data could be "wrongly" saved in CoreStore causing these un-archiving warnings? (differentiating pre-iOS 14 and iOS-14, perhaps ?)

Thank you !

Originally created by @sebastien-tribu on GitHub (Feb 16, 2021). Hi, I recently herited a project for work which uses CoreStore. On launching the app on Simulator (but same warnings appear on device), the app will load data from using `fetchOne`, like so: ``` func image(with id: String) throws -> Image? { // Image is autogenerated in Image+CoreDataClass.swift let image = try CoreStoreDefaults.dataStack.fetchOne( From<Image>() .where(\.id == id) ) return image } ``` Here's the issue: every time that the data is loaded, a bunch of runtime warnings appear (i.e. one per loaded image in my use case.): ``` [general] 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release [general] 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release [general] 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release ... ``` 1. According to [this stackoverflow question](https://stackoverflow.com/questions/64583182/how-to-determine-which-core-data-transformable-attribute-is-not-using-secure-cod), it could be caused by transformable attributes, but I don't even know where to start to debug this using CoreStore. How would you debug this in CoreStore? 2. Do you know in which curcumstances data could be "wrongly" saved in CoreStore causing these un-archiving warnings? (differentiating pre-iOS 14 and iOS-14, perhaps ?) Thank you !
adam added the question label 2025-12-29 15:29:57 +01:00
adam closed this issue 2025-12-29 15:29:57 +01:00
Author
Owner

@JohnEstropia commented on GitHub (Feb 17, 2021):

Hi, thanks for the feedback. The deprecations have been handled in the develop branch, so feel free to use that branch for now. I'm currently finalizing documentations for some new features and I'll push the official update to master when that's wrapped up.

@JohnEstropia commented on GitHub (Feb 17, 2021): Hi, thanks for the feedback. The deprecations have been handled in the `develop` branch, so feel free to use that branch for now. I'm currently finalizing documentations for some new features and I'll push the official update to `master` when that's wrapped up.
Author
Owner

@JohnEstropia commented on GitHub (Feb 17, 2021):

I'd ask just in case, but do you have transformable attributes that implement custom transformers? If so then those transformers need to be updated in your side, and possibly to implement the proper migration for those data as well.

@JohnEstropia commented on GitHub (Feb 17, 2021): I'd ask just in case, but do you have transformable attributes that implement custom transformers? If so then those transformers need to be updated in your side, and possibly to implement the proper migration for those data as well.
Author
Owner

@sebastien-tribu commented on GitHub (Feb 17, 2021):

Hard to tell right now but I do have a sense that this could be the case. I'll come back here if I can wrap my head around this piece of code. Thanks

@sebastien-tribu commented on GitHub (Feb 17, 2021): Hard to tell right now but I do have a sense that this could be the case. I'll come back here if I can wrap my head around this piece of code. Thanks
Author
Owner

@JohnEstropia commented on GitHub (Feb 17, 2021):

If you have a .xcdatamodeld file in your project, you can look for any Transformable attribue and check if their Transformer or Custom Class is set in the model editor. If they are, you can search your project for classes or strings that match those names.

@JohnEstropia commented on GitHub (Feb 17, 2021): If you have a .xcdatamodeld file in your project, you can look for any Transformable attribue and check if their `Transformer` or `Custom Class` is set in the model editor. If they are, you can search your project for classes or strings that match those names.
Author
Owner

@sebastien-tribu commented on GitHub (Feb 17, 2021):

Right that's what the StackOverflow question suggested, but there is no .xcdatamodeld file to be found 🤔 still searching

@sebastien-tribu commented on GitHub (Feb 17, 2021): Right that's what the StackOverflow question suggested, but there is no .xcdatamodeld file to be found 🤔 still searching
Author
Owner

@JohnEstropia commented on GitHub (Feb 17, 2021):

If you can't find xcdatamodeld files, it's likely your project uses CoreStoreObject subclasses instead. You can search for these and look for either Value.Transformable (classic syntax) or @Field.Coded (new syntax) properties

@JohnEstropia commented on GitHub (Feb 17, 2021): If you can't find xcdatamodeld files, it's likely your project uses `CoreStoreObject` subclasses instead. You can search for these and look for either `Value.Transformable` (classic syntax) or `@Field.Coded` (new syntax) properties
Author
Owner

@sebastien-tribu commented on GitHub (Feb 19, 2021):

Aha, I was mistaken, we do have a .xcdatamodel file ! I'll create a new model version to fix these warnings on our project.

Many thanks for your guidance @JohnEstropia

@sebastien-tribu commented on GitHub (Feb 19, 2021): Aha, I was mistaken, we do have a .xcdatamodel file ! I'll create a new model version to fix these warnings on our project. Many thanks for your guidance @JohnEstropia
Author
Owner

@JohnEstropia commented on GitHub (Feb 21, 2021):

@sebastien-tribu I see. Just be sure to test your migrations because there is the possibility that the old encoded objects (which were encoded using the deprecated encoder) may not be compatible with the new secured archivers.

Good luck!

@JohnEstropia commented on GitHub (Feb 21, 2021): @sebastien-tribu I see. Just be sure to test your migrations because there is the possibility that the old encoded objects (which were encoded using the deprecated encoder) may not be compatible with the new secured archivers. Good luck!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/CoreStore#358