Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RealmSwiftObject empty #310

Open
oenama opened this issue Aug 21, 2019 · 3 comments
Open

RealmSwiftObject empty #310

oenama opened this issue Aug 21, 2019 · 3 comments

Comments

@oenama
Copy link

oenama commented Aug 21, 2019

Realm object is empty

here's the model declaration:

Category.swift

import EVReflection
import RealmSwift

 @objcMembers

class  Category :  Object, EVReflectable  {
 
    override class func primaryKey() -> String? {
        return "id"
    }
       dynamic var id : NSNumber = 0
       dynamic var name : String?
       dynamic var sub_Category : SubCategory?  // the empty object 

 }

SubCategory.swift


import EVReflection
import RealmSwift

 @objcMembers


class  SubCategory :  Object, EVReflectable  {
 
        dynamic var name : String?
        dynamic var type : String?

 }

API response - > JSON

{
id = 45 
name = "test category"
 sub_Category =     {
        name = "test";
        type = "testType";
     }
 }

--> let result_ = Category(json: responseData as? String)

print(result_) -->

Products {
	id = 45;
       name = "test category"; 
      sub_Category = RealmSwiftObject {
	};    // -->  here's the empty object 
 }
 

any idea why this happens ?


EVReflection -> Version 5.10.1
Realm -> Version 3.16.1

**pods installed **
pod 'EVReflection'
pod 'EVReflection/Realm'


@oenama
Copy link
Author

oenama commented Aug 21, 2019

I don't know if it's related to issue #300 cuz the main object is fine
@evermeer

@tobyworks
Copy link

Im having the exact same problem. @oenama Have you found a solution yet? it happened for me when i switched from xcode 10.1 to 10.3 thus having to upgrade my evreflection library to 5.10.1

@tobyworks
Copy link

@evermeer @oenama any updates on this issue? it currently prevents me from upgrading to swift 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants