Backendless Entity not uploading correctly

Hi,

I updated to Backendless 5 and corrected a lot of problems. I have the following code that used to work:

class func updateCurrentUser(with Object: [Objects]) -> Promise {
currentUser.object = Object
return Promise { (fulfill, reject) in
backendless.userService.update(currentUser, response: { responseUser in
fulfill(responseUser!)
}, error: { fault in
reject(fault!)
})
}
}

The Object is correct and is of type “BackendlessEntity”, This object should fill out another table that has a relational link to the user table. The returned user no longer has the object which makes no sense to me and the table remains empty for my users. If i try and retrieve the data it also doesn’t exist.

there doesn’t seem to be any change between the Backendless 3 or Backendless 5 functions for this operation. Could you please clarify why this is not working?

best

F

Hi,

when you update parent object its children would not be saved, because backendless 5 does not save related objects, only parent object. Please read how to handle relations http://backendless.com/docs/js/doc.html#data_relations_api_set_add_js

So if I understand this correctly. I need to save the child objects in their own table, and then create a relation between them?

Yes, exactly. First you save the child objects, then you save a relation between the parent and the child objects.

1 Like

Ok this is not working. Do you have a sample iOS app that shows this setup?

The documentation for iOS shows examples of the API for saving objects and for creating relations. We’re you able to find it in the docs?

Yes but they don’t work, I think Im missing something

Try debugging the code to understand where things go wrong. Report back what you find out

1 Like