Users overview
Understand user profiles, friend relationships, blocklists, and online status in OpenIM iOS SDK.
OpenIM SDK identifies each user by userID. When implementing profile cards, friend requests, contacts, or blocklists, distinguish between a user's public profile, the current user's friend relationships, and blocklist status.
Group member lists, group nicknames, group roles, and member administration belong to the group domain. See Retrieve group members for details.
User types
OpenIM SDK returns different user objects for different scenarios:
| Type | When to use it | Main APIs |
|---|---|---|
OIMUserInfo | The signed-in user's profile, settings page, avatar, nickname, and message-reception option | getSelfInfoWithOnSuccess:onFailure:, setSelfInfo:onSuccess:onFailure: |
OIMPublicUserInfo | Looking up application users, finding friend candidates, and displaying profiles for users who are not friends | getUsersInfo:onSuccess:onFailure: |
OIMFriendInfo | The signed-in user's friend list, friend remarks, and relationship extension fields | getFriendListPageWithOffset:count:filterBlack:..., getSpecifiedFriendsInfo:filterBlack:... |
OIMBlackInfo | Users blocked by the signed-in user | getBlackListWithOnSuccess:onFailure:, addToBlackList:ex:onSuccess:onFailure:, removeFromBlackList:onSuccess:onFailure: |
OIMUserStatusInfo | A user's online status and list of connected platforms | subscribeUsersStatus:onSuccess:onFailure: |
The same userID can appear in public-profile, friend, blocklist, and group-member data. Prefer OIMFriendInfo when displaying a contact, OIMPublicUserInfo when only the account's public profile is needed, and OIMGroupMemberInfo when displaying a group member. Conversation-list and chat-page titles belong to conversation data and should use OIMConversationInfo.showName.
Feature guide
The following table maps common user-related requirements to their recommended pages:
| Requirement | Recommended page |
|---|---|
Look up public profiles by userID to find friend candidates or display profile cards | Retrieve public profiles by user ID |
| Paginate, search, or retrieve friend relationships by ID | Retrieve the friend list by page |
| Send, retrieve, accept, reject, or delete friend-request records | Retrieve received friend requests |
| Update friend information | updateFriends:onSuccess:onFailure: |
| Delete a friend relationship | deleteFriend:onSuccess:onFailure: |
| View and manage the current user's blocklist | Retrieve the blocklist |
| Read or update the current user's nickname, avatar, and extended profile | Update your profile |
| Configure account-level message reception and notification behavior | Set global message reception |
| Subscribe to and retrieve online status | Subscribe to user status |
| Retrieve group-member lists, search members, or retrieve specified member profiles | Retrieve group members |
State updates
Each category of user-related events is handled and merged on its owning page:
- Changes to the current user's profile: see Update your profile.
- Changes to friend requests: see Retrieve received friend requests.
- Changes to friend relationships and friend information: see Retrieve the friend list by page.
- Changes to the blocklist: see Block a user.
- Changes to online status: see Subscribe to user status.
Each page first retrieves a snapshot, then merges incremental updates through the delegate owned by that page.
Was this page helpful?