Yet another "Duplicate property" error topic

Hey there

I’m also experiencing this “duplicate property” error when updating objects (Server reported an error: FAULT = ‘8001’ [Duplicate property: MessageObjects] <Duplicate property: MessageObjects> ). What’s really strange though is that the first I append an object to the array in the object, everything works fine. However, the second time and all subsequent times, it gives me this “Duplicate property” error. To make it work again, I have to build the app again from Xcode - then it also works again, but only the first time I make an update. I have also found that it helps to kill the app and then restart it - again it only works to update the first time. After that I again get the “Duplicate property” error.
Can you guys help me?

I have attached my code here. Please let me know if you need anything else.


backendless.data.of(ConversationObject.ofClass()).find(dataQuery, response: { (response: BackendlessCollection!) -> () in
                    
                    let conversationArray = response.getCurrentPage()
                    if conversationArray.count == 1 {
                        let conversation = conversationArray.first as! ConversationObject
                        conversation.MessageObjects?.append(message)
                        
                        let dataStore = backendless.data.of(ConversationObject.ofClass())
                        dataStore.save(
                            conversation,
                            response: { (result: AnyObject!) -> Void in
                                let obj = result as! ConversationObject
                                print("Message has been saved: \(obj.objectId)")


},
                            error: { (fault: Fault!) -> Void in
                                print("Server reported an error: \(fault)")
                                
                        })
                        
                        
                    }
                    
                    }, error: { (error: Fault!) -> () in
                })

I solved this by not appending any elements to the array.

Instead, I created a handler for the MessageObject that then adds the message to an existing conversation.