SDKsiOSEnterprise
Delete friend requests
Delete friend-request records with OpenIM iOS SDK.
Batch-delete historical friend application records using deleteFriendRequests:onSuccess:onFailure:. Deleting application history cleans up request logs without mutating or terminating established friend relationships.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
friendRequests | NSArray<DeleteFriendRequest *> * | Yes | List of DeleteFriendRequest objects to delete. Each item must supply both fromUserID and toUserID. |
Code example
DeleteFriendRequest *request =
[[DeleteFriendRequest alloc] initWithFromUserID:application.fromUserID
toUserID:application.toUserID];
[[OIMManager manager] deleteFriendRequests:@[request]
onSuccess:^(NSString *data) {
[applicationStore removeApplicationForFromUserID:application.fromUserID
toUserID:application.toUserID];
}
onFailure:^(NSInteger code, NSString *message) {
NSLog(@"deleteFriendRequests failed: %ld %@", (long)code, message);
}];Return value
The onSuccess callback signifies that OpenIMServer deleted the specified application records.
State changes after the call
- Local state merge: Remove matching application records from local UI collections using
fromUserID:toUserIDas the composite key. - Asynchronous event listening: Multi-terminal devices synchronize the deletion via
onFriendApplicationDeleted:inOIMFriendshipListener(see Retrieve received friend requests). - Relationship boundary: This operation only clears pending or archived application logs; it does not alter actual friendship relationships.
Was this page helpful?