Add new entity in the existing object?

Hello, how i can to add new entity in the existing object. According to such scheme.
http://support.backendless.com/public/attachments/9909d185cafcb9c9f857e911b6732e51.png</img>
What is function addContact ?

You’re right addContact is not declared there. It is simply a function that adds contact to the array:

[self.contacts addObject:contact];

It means that in my program I simply have to write it in h. file, and run function add ?

i believe the code would need to go to the .m file. The .h files are just for declarations.

nevertheless I do not understand as it to make. Help please. What i do: i retrieve Object, which have
NSString *ObjectId;
NSString *name;
NSArray<OtherObject *> otherObject;(represented relationships)

Ok, so, i add to this retrieved Object a new OtherObject, and when i save, all OtherObjects, which saved before lose relations with Object. How can i fix this?

Update : Sorry for my English. I use Backendless service. I have two entity: Object and Object2. Object have property:

    NSString *objectID; NSString *objectName; NSMutableArray < Object2* > *object2; (represented relationship).
In Backendless datastore i have one Object, which have 2 relationships with Object2. The scheme : http://support.backendless.com/public/attachments/714067d1ac79f85b24dd3ccc7b31b739.png</img> So, i need to add other Object2 in Object. The scheme: http://support.backendless.com/public/attachments/2426573618d8d3bf55d7a4ec1a68bc8d.png</img> I want to add Object2 in Object. But when i add it i lose relationships with old Object2 and have relationships only with new Object2. http://support.backendless.com/public/attachments/b8a1ce69d7de1dfe167f104a89de21e0.png</img> My code is: [Object.object2 addObject: newObject2];

[backendless.persistenceService update:Object response:^(id regs) {

} error:^(Fault *error) {

}];How can i fix this?

2426573618d8d3bf55d7a4ec1a68bc8d.png

714067d1ac79f85b24dd3ccc7b31b739.png

b8a1ce69d7de1dfe167f104a89de21e0.png

Can you help me?

Hi,

By default when an object is retrieved from Backendless using any of the find APIs (basic or advanced), its related objects are not included into the response.

For your purpose you can use Relations Auto Load. Check on autoload checkbox on Object2 1:N relation in Object table, and you will retrieve your Object objects with Object2 1:N relation.

Another way (without autoload) is to use methods supporting relation depth, for example (in swift):

 let dataStore = backendless.data.of(Object.ofClass())
 var error: Fault?
 
 let object = dataStore.findFirst(1, fault:&error) as? Object
 if error == nil {
 print("Found: \(object!)")
 updateObject(object!)
 }
 else {
 print("Server reported an error (2): \(error)")
 }

Regards,
Slava