Support Topics Documentation Slack YouTube Blog

Null values are being saved -- iOS -- swift

When I try to save my class, null values are being saved.

Here is my class

class Profile : NSObject {

var phoneNumber : String?

var personName : String?

var emailAddress : String?

var address : String?

var orderCount : String?

var accountType : String?

var created : NSDate?

var updated : NSDate?

var objectId: String?

}

Here is my code to save it

self.backendless.data.of(Profile.self).save(entity: profile, responseHandler: { (data) in
print(data)
}) { (error) in
print(error)
}

I am getting a response that object is saved but all that are saved are null values.

I checked and the entity that I am saving (profile) has data in it.
Is there any possible explanation why this is happening?

Hello @Kiran_Viswanadhapalli,
You miss the @objcMembers attribute in your class. Please change it to:

@objcMembers class Profile : NSObject {
...
}

Please check this documentation for more info.

Regards,
Olha

1 Like

Thank you too much. I don’t know how I missed it