Backendless Support
 
Answered

How to resolved a 'duplicate error' when updating a user (iOS/Swift)

Hi,

Im busy setting up a user account section in my app, and capturing and saving a bunch of data.

I found myself in a problem where, when i ' self.backendless.userService.update(user, response: { (user: BackendlessUser!)' i get the following error...

  1. Server reported an error: FAULT = '8001' [Duplicate property: Age] <Duplicate property: Age>

I think this has to do with the fact that I had originally saved a property called 'Age' to my user table.

I then decided that I had made a mistake and the property should have been lowercase 'age', so I changed my code to add the saved value to a new property of 'age'.

I think thats when I started getting the error. I then went to my Backendless dashboard and deleted the existing 'Age' field, thinking that might help with the error, but I still am stuck as it still fails with the duplicate error.

It seems I cant now update my User object at all, because of this duplicate property issue and I dont know how to resolve it or overcome it.

Ive tried to play around with the 'removeProperty("Age")' and update the user again, but that didnt help things, so i could be doing it wrong.

Any ideas? Thanks!

a log before the update attempt

  1. ["lastLogin": 2016-03-11 20:47:34 +0000, "user-token": xxxxxxxxxxxx, "Age": <null>, "lastName": Archer, "__meta": {"relationRemovalIds":{},"selectedProperties":["__updated__meta","lastName","password","created","name","___class","ownerId","updated","email","objectId"],"relatedObjects":{}}, "objectId": xxxxx, "age": 26-29, "profilePicFile": xxxxxxx, "ownerId": <null>, "updated": <null>, "email": xxxxxx@gmail.com, "name": Simon, "created": 2016-02-27 10:47:55 +0000]

    **** Server reported an error: FAULT = '8001' [Duplicate property: Age] <Duplicate property: Age>

Leave a Comment

Comments (10)

photo
1

Hi Simon,

Could you please let us know your application ID and we'll take a look it from the backend perspective.

Regards,

Mark

photo
1

Hey Mark,

Thanks for the reply! My app ID is- 29100CD0-A42D-0188-FFEC-947AB5CA5900

Appreciate the help and feedback!

photo
1

Well, the server was not lying.. ))

6430533f781ef4ea73ba70ea7d66bfcd

photo
1

Thanks Mark!

Yeah Im trying to understand how to resolve that issue. It seems to be stuck in my user's 'properties' that fails when i update the user.

I cant find a way to remove that duplicated field in my iOS backendless user so I can update the user again..

photo
1

Could you check if it is there right after you retrieve the user object from the server (check in the debugger that is)?

photo
1

when i login, this is my user that is returned..

  1. User has been logged in (ASYNC): <BackendlessUser> {

    "__meta" = "{\"relationRemovalIds\":{},\"selectedProperties\":[\"__updated__meta\",\"lastName\",\"profilePicFile\",\"password\",\"created\",\"name\",\"___class\",\"ownerId\",\"updated\",\"email\",\"objectId\"],\"relatedObjects\":{}}";

    created = "2016-02-27 10:47:55 +0000";

    email = "simonarch@gmail.com";

    lastLogin = "2016-03-14 18:48:08 +0000";

    lastName = Archer;

    name = Simon;

    objectId = "6685DBE0-6936-E172-FFFC-1FD13D6CFF00";

    ownerId = "<null>";

    profilePicFile = "https://api.backendless.com/29100cd0-a42d-0188-ffec-947ab5ca5900/v1/files/userProfilImages/6685DBE0-6936-E172-FFFC-1FD13D6CFF00.jpeg";;

    updated = "2016-03-13 20:49:29 +0000";

    "user-token" = "A4BDB828-CF17-2B14-FF51-EED156D92C00";

    }

hope that is what you were asking for?

photo
1

Yes, thank you. This tells me the "Age" and "age" properties are added to the object after you retrieve it from the backend and before you use the API to update it.

photo
photo
1

I had the same problem and for me it was helpful to delete duplicated properties at backendless web console and then call once

  1. activeUser.removeProperty(propertyName)

Then create needed property in backendless web console again.

After then everything start to work as i wanted.

photo
1

thanks guys. What I ended up doing was logging in with the user on another device, which didnt seem to persist any of the duplicate properties associated with the user. And when updating a user on that device was working fine, i deleted the app on my original device, re-logged in, and everything was fine again. :) So maybe not the *ideal* solution, but deleting the app and re-installing saved me from that state. :)

photo
1

We're experiencing the same problem:

fServer reported an error: FAULT = '8001' [Duplicate property: aDescription] <Duplicate property: aDescription>

I've tried some of the suggestions above, but there's still a problem with the Property class. Our App ID is 6B0D8C39-40E5-BC10-FF0E-BC967700C300