Update user profiles, avatars, and metadata using the social.plus SDK
Modify user profiles including display names, descriptions, avatars, and custom metadata. social.plus SDK provides comprehensive methods to update user information for the currently authenticated user.Image Upload: Before setting an avatar, you must first upload the image file. Refer to the Image Upload guide for detailed instructions.
User Authorization: Only the currently authenticated user can update their own profile information. Administrators may have additional privileges through the Console.
Copy
Ask AI
// Build the current user datalet builder = AmityUserUpdateBuilder()builder.setDisplayName("Batman")builder.setUserDescription("Hero that Gotham needs")builder.setAvatar(imageData)// Add custom metadatalet metadata = ["role": "superhero", "city": "Gotham"]builder.setMetadata(metadata)// Update the current user from the builderclient.updateUser(builder) { success, error in if let error = error { print("Update failed: \(error.localizedDescription)") } else { print("User updated successfully") }}
Batch Updates: When updating multiple user properties, combine them into a single update operation instead of making separate calls for better performance.
Rate Limiting: Be mindful of update frequency to avoid hitting rate limits. Consider implementing debouncing for real-time input fields.