/ SDKs / iOS
SDKs
Chat SDKs iOS v4
Chat SDKs iOS
Chat SDKs
iOS
Version 4

Update user profile

Copy link

You can update a user's nickname and profile image with a profile URL using UserUpdateParams and updateCurrentUserInfo(params:progressHandler:completionHandler:). A user's profile image can be a JPG (.jpg), JPEG (.jpeg), or PNG (.png) file of up to 5 MB.

let params = UserUpdateParams()
params.nickname = NICKNAME
params.profileImageURL = PROFILE_URL

SendbirdChat.updateCurrentUserInfo(params: params, progressHandler: nil) { error in
    guard error == nil else {
        // Handle error.
        return
    }

    // The current user's profile is successfully updated.
    // You could redraw the profile in a view in response to this operation.
}

Or, you can directly upload a profile image by following the code below.

let params = UserUpdateParams()
params.nickname = NICKNAME
params.profileImageData = PROFILE_FILE

SendbirdChat.updateCurrentUserInfo(params: params) { bytesSent, totalBytesSent, totalBytesExpectedToSend in

} completionHandler: { error in
    guard error == nil else {
        // Handle error.
        return
    }

    // A new profile images is successfully uploaded to the Sendbird server.
    // You could redraw the profile in a view in response to this operation.
}