Skip to content

Realm Object broke after ea87088 #300

Open

Description

@guilhermearaujo

I am using EVReflection 5.7.0 and it works fine. After upgrading to 5.8.0 (or 5.90), my Realm Object models no longer work.

Nothing wrong happens during the deserialisation, but when I try to access one of their properties, I get a SIGABRT.

I tested each commit and found changes on ea87088 to be causing this.
This is my model declaration:

class Category: Object, EVReflectable {
  @objc dynamic var id: Int = 0
  @objc dynamic var name: String = ""
  @objc dynamic var hexColor: String = ""
  @objc dynamic var imageUrl: String = ""
}

And this is some lldb data from the deserialised object:

(lldb) po category
RealmSwiftObject {
}

(lldb) po category.toJsonString()
"{}"

(lldb) po category.name
error: Execution was interrupted, reason: breakpoint 1.1.
The process has been returned to the state before expression evaluation.

Using 5.7.0, however:

(lldb) po category
Category {
	id = 6;
	name = Some name;
	hexColor = #dd6254;
	imageUrl = https://some.url/image.jpg;
}

(lldb) po category.toJsonString()
"{\"color\":\"#dd6254\",\"id\":6,\"imageUrl\":\"https:\\/\\/some.url\\/image.jpg\",\"name\":\"Some name\"}"

(lldb) po category.name
"Some name"

Activity

  1. volkoivan commented on Mar 26, 2019

    @volkoivan

    Can confirm, I have the same problem. Took me a day to figure out what happened with the project.
    And now I'm stuck with broken project, because new Xcode doesn't compile the 5.8.0 version

  2. evermeer commented on Mar 28, 2019

    @evermeer
    Owner

    When using Xcode 10.2 you should use EVReflection version 5.10.1 or later. If cocoapods installs an earlier version, then you should upgrade cocoapods to version 1.7.0.

  3. evermeer commented on Apr 1, 2019

    @evermeer
    Owner

    @megavirus74 and @guilhermearaujo could you confirm that you are using EVReflection version 5.10 or later and still have this problem?

  4. guilhermearaujo commented on Apr 1, 2019

    @guilhermearaujo
    Author

    @evermeer a while ago I decided not to use Realm anymore and switched to the regular EVReflection.

  5. evermeer commented on Apr 27, 2019

    @evermeer
    Owner

    If someone still has this issue, then just reopen this.

  6. bennettyuan commented on Aug 28, 2019

    @bennettyuan

    I also encountered the same issue. Finally, I find source cause of this issue.
    The source is swiftClassTypeFromString(_:).
    It cannot be convert some Realm class, like List<FooRealmObject>.

    I modified setPropertiesfromDictionary(_:anyObject:conversionOptions:forKeyPath:) back to:

    if let c = original as? EVCustomReflectable {
        if let v = c.constructWith(value: value) {
            value = v
        }
    }

    Then solved this issue of Realm crash. (But, this is a temporary solution)

    I think we need rethink how to "construct" better.

  7. evermeer commented on Aug 28, 2019

    @evermeer
    Owner

    @bennettyuan18 I will have a look at this later. Reopening this issue so that I won't forget.

  8. tobyworks commented on Oct 3, 2019

    @tobyworks

    For anyone with the same issue for now you can use my fork in your podfile:

      pod 'EVReflection/Realm', :git => 'https://github.com/tobybonhof/EVReflection'
    
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