Browse SDKs · iOS
Platform
SDKsiOSEnterprise

Delete friend requests

Delete friend-request records with OpenIM iOS SDK.

Copy

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

ParameterTypeRequiredDescription
friendRequestsNSArray<DeleteFriendRequest *> *YesList 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:toUserID as the composite key.
  • Asynchronous event listening: Multi-terminal devices synchronize the deletion via onFriendApplicationDeleted: in OIMFriendshipListener (see Retrieve received friend requests).
  • Relationship boundary: This operation only clears pending or archived application logs; it does not alter actual friendship relationships.