Skip to content

transformable properties issue #165

Open

Description

@siideffect

Hi, im using the latest stable version on graph im my project (i also tried development branch but the issue is there too).
Since i updated to iOS 13, i am experiencing what looks like a bad error, which i will post here:

[error] fault: One or more models in this application are using transformable properties with transformer names that are either unset, or set to NSKeyedUnarchiveFromDataTransformerName. Please switch to using "NSSecureUnarchiveFromData" or a subclass of NSSecureUnarchiveFromDataTransformer instead. At some point, Core Data will default to using "NSSecureUnarchiveFromData" when nil is specified, and transformable properties containing classes that do not support NSSecureCoding will become unreadable.

CoreData: fault: One or more models in this application are using transformable properties with transformer names that are either unset, or set to NSKeyedUnarchiveFromDataTransformerName. Please switch to using "NSSecureUnarchiveFromData" or a subclass of NSSecureUnarchiveFromDataTransformer instead. At some point, Core Data will default to using "NSSecureUnarchiveFromData" when nil is specified, and transformable properties containing classes that do not support NSSecureCoding will become unreadable.

2020-01-03 18:39:45.842073+0100 APPNAME[50600:5957542] [error] CoreData: One or more models in this application are using transformable properties with transformer names that are either unset, or set to NSKeyedUnarchiveFromDataTransformerName. Please switch to using "NSSecureUnarchiveFromData" or a subclass of NSSecureUnarchiveFromDataTransformer instead. At some point, Core Data will default to using "NSSecureUnarchiveFromData" when nil is specified, and transformable properties containing classes that do not support NSSecureCoding will become unreadable.

Now some specific error: these errors are related to specific graph classes.

CoreData: warning: Property 'object' on Entity 'ManagedRelationshipProperty' is using nil or an insecure NSValueTransformer. Please switch to using "NSSecureUnarchiveFromData" or a subclass of NSSecureUnarchiveFromDataTransformer instead.

CoreData: warning: Property 'object' on Entity 'ManagedEntityProperty' is using nil or an insecure NSValueTransformer. Please switch to using "NSSecureUnarchiveFromData" or a subclass of NSSecureUnarchiveFromDataTransformer instead.

CoreData: warning: Property 'object' on Entity 'ManagedActionProperty' is using nil or an insecure NSValueTransformer. Please switch to using "NSSecureUnarchiveFromData" or a subclass of NSSecureUnarchiveFromDataTransformer instead.

I have no idea on how to solve this, and where to start, but it looked like a "Hey, you need to fix me asap or i can break your app and make it unasable".
Hope you can address this in the development branch you currently are, waiting for a response from you and keep up the good work, graph is awesome.

Activity

  1. bbruno84 commented on Mar 29, 2020

    @bbruno84

    Any update?

  2. siideffect commented on Mar 30, 2020

    @siideffect
    Author

    I dont have any. Still waiting for a response from the owner, you got the same issue?

  3. bbruno84 commented on Mar 30, 2020

    @bbruno84
  4. siideffect commented on Mar 30, 2020

    @siideffect
    Author

    I hope to get some news from the owner too, since everything looks abandoned: quite time has passed since opening this thread, and any communication about the state of the repo would be greatly appreciated.

  5. OrkhanAlikhanov commented on Mar 30, 2020

    @OrkhanAlikhanov
    Contributor

    I've deleted my xcode months ago, can't help exactly but give a try to following.

    Graph/Sources/Model.swift

    Lines 163 to 165 in 9472031

    let propertyValue = NSAttributeDescription()
    propertyValue.name = "object"
    propertyValue.attributeType = .transformableAttributeType

    Try adding following after above lines and see if it works:

    if #available(iOS 12, *) {
      propertyValue.valueTransformerName = "NSSecureUnarchiveFromDataTransformer"
    }

    if it does not work define following class:

    @objc(DefaultTransformer)
    class DefaultTransformer: ValueTransformer {
        override class func transformedValueClass() -> AnyClass {
            return NSData.self
        }
    
        override open func reverseTransformedValue(_ value: Any?) -> Any? {
            guard let value = value as? Data else {
                return nil
            }
            return NSKeyedUnarchiver.unarchiveObject(with: value)
        }
    
        override class func allowsReverseTransformation() -> Bool {
            return true
        }
    
        override func transformedValue(_ value: Any?) -> Any? {
            guard let value = value else {
                return nil
            }
            return NSKeyedArchiver.archivedData(withRootObject: value)
        }
    }

    taken from SO

    And do:

    if #available(iOS 12, *) {
      propertyValue.valueTransformerName = "DefaultTransformer" // or NSStringFromClass(DefaultTransformer.self), or String(describing: DefaultTransformer.self)
    }
  6. daniel-jonathan commented on Mar 30, 2020

    @daniel-jonathan
    Member

    @OrkhanAlikhanov Thank you for your response. I as well don’t have the latest Xcode, at least for 6 months now.

    To answer the question, whether the frameworks have died, I would say no, but it is up to the community to support it. We have been working on something new, and all our resources are aimed towards that project. We haven’t shared this publicly yet, as we did try to come up with ways for the maintenance to last on our end, but it is unfortunately not possible.

  7. bbruno84 commented on Mar 30, 2020

    @bbruno84

    I've deleted my xcode months ago, can't help exactly but give a try to following.

    Graph/Sources/Model.swift

    Lines 163 to 165 in 9472031

    let propertyValue = NSAttributeDescription()
    propertyValue.name = "object"
    propertyValue.attributeType = .transformableAttributeType

    Try adding following after above lines and see if it works:

    if #available(iOS 12, *) {
      propertyValue.valueTransformerName = "NSSecureUnarchiveFromDataTransformer"
    }

    if it does not work define following class:

    @objc(DefaultTransformer)
    class DefaultTransformer: ValueTransformer {
        override class func transformedValueClass() -> AnyClass {
            return NSData.self
        }
    
        override open func reverseTransformedValue(_ value: Any?) -> Any? {
            guard let value = value as? Data else {
                return nil
            }
            return NSKeyedUnarchiver.unarchiveObject(with: value)
        }
    
        override class func allowsReverseTransformation() -> Bool {
            return true
        }
    
        override func transformedValue(_ value: Any?) -> Any? {
            guard let value = value else {
                return nil
            }
            return NSKeyedArchiver.archivedData(withRootObject: value)
        }
    }

    taken from SO

    And do:

    if #available(iOS 12, *) {
      propertyValue.valueTransformerName = "DefaultTransformer" // or NSStringFromClass(DefaultTransformer.self), or String(describing: DefaultTransformer.self)
    }

    Thank you for the answer, it worked!! I used the class way, because the first try crashes into an UIImage object. Thanks a lot.

  8. bbruno84 commented on Mar 30, 2020

    @bbruno84

    @DanielDahan Thanks for clarifying about the project state, I really appreciate the work you've done. Good luck for your next project, and yes, I've already subscribed to early access!

  9. daniel-jonathan commented on Mar 30, 2020

    @daniel-jonathan
    Member

    @bbruno84 thank you! We look forward to feedback and the benefit this project can have. All the best!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions