Skip to main content

checkFriend

Description​

info

Check the friend relationship. If the user is not in your friend list or has been added to the blocklist, the returned result is non-friend. If you only need to check if the other party is in your friend list, it is recommended to call the getSpecifiedFriendsInfo API.

Note

Since friendship is a two-way relationship, only checking whether the other party is in your friend list cannot verify whether you are in their friend list.

Function Prototype​


- (void)checkFriend:(NSArray <NSString *> *)usersID
onSuccess:(nullable OIMSimpleResultsCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;

Input Parameters​

Parameter NameParameter TypeRequiredDescription
usersIDNSArray <NSString *>YesList of User IDs

Return Result​

Parameter NameParameter TypeDescription
onSuccessNSArray< OIMSimpleResultInfo * >Success
onFailureOIMFailureCallbackFailure

OIMSimpleResultInfo​

Field NameField TypeDescription
userIDNSStringUser ID
resultNSIntegerWhen checkFriend: result is 1 means friend (and not in blocklist)

Code Example​


[OIMManager.manager checkFriend:@[]
onSuccess:^(NSArray<OIMSimpleResultInfo *> * _Nullable results) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];