Hello Backendless,
I have petProfile table which has the relationship with users.
user: petProfile has 1:N relationship for sure.
When I add a pet, I try to use ‘AddProperty’ bcs I need to add an object into petProfile array in user table.
I can store petProfile well but cannot add this object using AddProperty. Can u check why?
let _ = user.addProperty([“petProfiles” : result!]) → responds nothing
Backendless.sharedInstance().data.save(profile, response: { (result) in
print("PetProfile havs been added: \(result!)")
dump(result)
let _ = user?.addProperties(["petProfiles" : result!])
completionHandler(true)
}) { (Fault) in
print("Server reported an error: \(Fault?.description)")
completionHandler(false)
}
You should use setProperty method instead of addProperties.
Also you don’t save your changes.
Add
self.backendless.data.save(user)
after
let _ = user?.setProperty(“petProfiles”, object:result!)
Hi Olga,
The reason I ask this question is that I want to add current instance object into existing array, not set the current instance replacing existing array. Am i understanding right?