SDKsiOS
Check friendship status
Check the friendship status of specified users with OpenIM iOS SDK.
Batch-verify friendship relationship statuses for target user IDs using checkFriend:onSuccess:onFailure:.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userIDs | NSArray<NSString *> * | Yes | List of user IDs to check. |
Code example
[[OIMManager manager] checkFriend:@[@"user_a", @"user_b"]
onSuccess:^(NSArray<OIMSimpleResultInfo *> *results) {
[relationshipStore mergeResults:results];
}
onFailure:^(NSInteger code, NSString *message) {
NSLog(@"checkFriend failed: %ld %@", (long)code, message);
}];Return value
The onSuccess callback delivers an array of OIMSimpleResultInfo objects. Each entry contains a userID and an integer result. A result of 1 indicates that the target user and the current account are mutual friends and neither has blacklisted the other.
State changes after the call
- Local state merge: Merge verification results into relationship caches using
userIDas the unique entity key. - Snapshot query: This call returns an instantaneous relationship snapshot and does not emit friendship delegate events.
- Full relationship profiles: To retrieve detailed profile properties like friend remarks or avatars, invoke Retrieve specified friends.
Was this page helpful?