Skip to content

Update User Object

User property values of the logged in users can be updated with an API operation described below. This operation is useful if an application needs to provide to the users the functionality for updating user profiles and registration properties. A user must be logged in in order to update his registration properties.

- (void)updateWithUser:(BackendlessUser * _Nonnull)user responseHandler:^(BackendlessUser * _Nonnull)responseHandler errorHandler:^(Fault * _Nonnull)errorHandler;
func update(user: BackendlessUser, responseHandler: ((BackendlessUser) -> Void)!, errorHandler: ((Fault) -> Void)!)


Argument                Description
user an instance of the BackendlessUser class which contains property values to update the user account with.

The return value from the server is BackendlessUser object.


The following errors may occur during the Update User Properties API call. See the Error Handling section for details on how to retrieve the error code when the server returns an error.

Error Code
Version is disabled or provided wrong application info (application id or secret key)
The property marked as "identity" is being updated and another user already has the specified value which must be unique.
General "update registration" error. Error message should contain additional details.
User is not logged in.
Cannot modify properties of another user. Returned when one user is logged and the call attempts to modify properties of another user.
Unable to locate user account - invalid user id.
A new "dynamic" property is being added, but dynamic property definition is disabled.
Required properties in the provided object do not contain values.


[Backendless.shared.userService loginWithIdentity:@"" password:@"iAmWatchingU" responseHandler:^(BackendlessUser *loggedInUser) {
    [loggedInUser setPropertyWithPropertyName:@"name" propertyValue:@"James"];
    [Backendless.shared.userService updateWithUser:loggedInUser responseHandler:^(BackendlessUser *updatedUser) {
        NSLog(@"User has been updated");
    } errorHandler:^(Fault *fault) {
        NSLog(@"Error: %@", fault.message);
} errorHandler:^(Fault *fault) {
    NSLog(@"Error: %@", fault.message);
Backendless.shared.userService.login(identity: "", password: "iAmWatchingU", responseHandler: { loggedInUser in
    loggedInUser.setProperty(propertyName: "name", propertyValue: "James")
    Backendless.shared.userService.update(user: loggedInUser, responseHandler: { updatedUser in
        print("User has been updated")
    }, errorHandler: { fault in
        print("Error: \(fault.message ?? "")")
}, errorHandler: { fault in
    print("Error: \(fault.message ?? "")")