CosmicMind / Graph

Graph is a semantic database that is used to create data-driven applications.
http://cosmicmind.com
MIT License
875 stars 79 forks source link

transformable properties issue #165

Open siideffect opened 4 years ago

siideffect commented 4 years ago

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.

bbruno84 commented 4 years ago

Any update?

siideffect commented 4 years ago

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

bbruno84 commented 4 years ago

Yes, and I think every Graph user has the the same issue, too. I hope that the project is still alive and will be updated. A response from the owner would be appreciated. Il 30 mar 2020, 13:27 +0200, siideffect notifications@github.com, ha scritto:

I dont have any. Still waiting for a response from the owner, you got the same issue? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

siideffect commented 4 years ago

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.

OrkhanAlikhanov commented 4 years ago

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

https://github.com/CosmicMind/Graph/blob/94720311644477402513c90ce6f18f3461142ea9/Sources/Model.swift#L163-L165

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)
}
daniel-jonathan commented 4 years ago

@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.

bbruno84 commented 4 years ago

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

https://github.com/CosmicMind/Graph/blob/94720311644477402513c90ce6f18f3461142ea9/Sources/Model.swift#L163-L165

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.

bbruno84 commented 4 years ago

@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!

daniel-jonathan commented 4 years ago

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