Update user profiles, avatars, and metadata using the social.plus SDK
Update the authenticated user’s profile (display name, description, avatar, and custom metadata) using editUser() on iOS/Android or UserRepository.updateUser() on TypeScript. Only the current user can update their own profile.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.
// Build the current user datalet options = AmityUserUpdateOptions()options.setDisplayName("Batman")options.setUserDescription("Hero that Gotham needs")options.setAvatar(nil)// Add custom metadatalet metadata: [String: Any] = ["role": "superhero", "city": "Gotham"]options.setUserMetadata(metadata)// Update the current user from the optionsdo { try await client.editUser(options) print("User updated successfully")} catch { print("Update failed: \(error.localizedDescription)")}
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.