Chat / iOS
Chat iOS v4
Chat iOS
Chat
iOS
Home
/
Chat
/
iOS
/
User
This is the new Docs for Chat SDK v4 for iOS. To see the previous Docs, click here.

Update user profile

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.
}