Browse SDKs · iOS
Platform
SDKsiOS

Retrieve specified friend profiles

Retrieve relationship profiles for specified friends with OpenIM iOS SDK.

Copy

Batch-query detailed relationship profiles for specified friends by user ID using getSpecifiedFriendsInfo:filterBlack:onSuccess:onFailure:.

Parameters

ParameterTypeRequiredDescription
userIDsNSArray<NSString *> *YesList of user IDs to query.
filterBlackBOOLYesWhether to filter out users currently present on the user's blacklist. Pass YES to exclude blacklisted friends.

Code example

[[OIMManager manager] getSpecifiedFriendsInfo:@[@"user_a", @"user_b"]
                                  filterBlack:YES
                                    onSuccess:^(NSArray<OIMFriendInfo *> *friends) {
                                        [friendStore mergeFriends:friends];
                                    }
                                    onFailure:^(NSInteger code, NSString *message) {
                                        NSLog(@"getSpecifiedFriendsInfo failed: %ld %@", (long)code, message);
                                    }];

Return value

The onSuccess callback delivers an array of OIMFriendInfo objects matching the queried IDs. If the returned array is empty, none of the requested users are friends with the current account, or all matching entries were excluded by the blacklist filter.

State changes after the call

  • Local state merge: Merge retrieved friend records into contact caches using userID as the unique entity key.
  • Snapshot query: This query establishes an instantaneous point-in-time snapshot and does not emit friendship delegate events.
  • Lightweight verification: To verify friend relationship status without fetching full relationship details, invoke Check friendship status.