Backendless Support

Users on multiple devices causing data mismatch

We are having a little trouble with Users in our app. When we update a user's properties, all the properties of that user get updated. For example, if we change a user's firstName like this:

  1. guard let user = backendless?.userService.currentUser else {return}

    let firstName = "Tom"

    user.setProperty("firstName", object: firstName)

    backendless?.userService.update(user, response: { (updatedUser) in

    print ("Update!")

    }, error: { (error) in

    print ("error updating user favs \(error)")


Every property that is stored in the memory of our app is sent and updated with backendless. This means that if the same user on another device changes his/her profile picture, the new profile picture will get overwritten by the above set of code even though it is not specified to set that property. Is there any way to avoid this?

Also, when that same user on his/her second device updates the profile picture field, it never synchronizes to the first device because the user field only gets refreshed data when the user logs in. Is there any way to update the persisted user each time the app launches?

Stay logged in is set to true in our app.

Leave a Comment

Comments (3)


One way to avoid this problem is to fetch the user object from the server before you make any changes to it.

When you update a user object, the client side sends all of the properties and all of them are persisted in the database. The client does not differentiate what was changed and what stayed the same, it flushes all the properties.

This will be easier when we roll out support for real-time database.




When do you think you will be rolling out support for real-time database? Approximatly


Hey Nevin

You are totally right, when you set any changes to currentUser and then try to save/update it you get the latest user object in response from the Backendless server. For ex: if you set "nickName", "lastName" and "picture" to the object then all of these properties will be updated after save/update.

Why do not you want to save all changed fields, you have some private fields that are needed only locally? if true you can create an EventHandler "beforeUpdate" for the Users table in Business Logic and save to the server only fields what you want

Unfortunately no, but currently we are working on real-time data synchronization between devices, we notify you when the feature is released

Regards, Vlad