SDKsiOS
Reject a friend request
Reject a friend request with OpenIM iOS SDK.
Decline an incoming friend application using refuseFriendApplication:handleMsg:onSuccess:onFailure:.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userID | NSString * | Yes | The applicant user ID whose request is being rejected. |
handleMsg | NSString * | No | Optional rejection note. Pass an empty string @"" when omitted. |
Code example
[[OIMManager manager] refuseFriendApplication:applicantUserID
handleMsg:@"Not adding contacts at this time"
onSuccess:^(NSString *data) {
[applicationStore markRejectedForUserID:applicantUserID];
}
onFailure:^(NSInteger code, NSString *message) {
NSLog(@"refuseFriendApplication failed: %ld %@", (long)code, message);
}];Return value
The onSuccess callback confirms that OpenIMServer processed the rejection command.
State changes after the call
- Local state merge: Merge rejection status into the application list using
userIDas the unique entity key. - Asynchronous event listening: Linked client devices and the applicant receive rejection notifications via
onFriendApplicationRejected:inOIMFriendshipListener(see Retrieve received friend requests).
Was this page helpful?