Browse SDKs · iOS
Platform
SDKsiOS

Retrieve the unhandled friend-request count

Retrieve the number of unhandled friend requests on iOS.

Copy

Query the count of pending, unhandled friend requests received after a specified timestamp using getFriendApplicationUnhandledCount:onSuccess:onFailure:. Use this count to render badge counts or unread indicator dots on contact tabs.

Parameters

ParameterTypeRequiredDescription
reqGetFriendApplicationUnhandledCountReq *YesRequest object specifying the cutoff timestamp.

Request attributes (GetFriendApplicationUnhandledCountReq)

ParameterTypeRequiredDescription
timeNSIntegerYesMillisecond timestamp. Typically pass the timestamp when the user last viewed the friend requests view.

Code example

GetFriendApplicationUnhandledCountReq *req = [GetFriendApplicationUnhandledCountReq new];
req.time = lastViewedAt;

[[OIMManager manager] getFriendApplicationUnhandledCount:req
                                               onSuccess:^(NSInteger count) {
                                                   [requestStore setUnhandledCount:count];
                                               }
                                               onFailure:^(NSInteger code, NSString *message) {
                                                   NSLog(@"getFriendApplicationUnhandledCount failed: %ld %@", (long)code, message);
                                               }];

Return value

The onSuccess callback delivers an integer count representing the total number of unhandled friend requests received after req.time.

State changes after the call

  • Local badge updates: Render or update tab badge indicators with the returned count.
  • Snapshot query: This query establishes an instantaneous point-in-time snapshot and does not emit delegate callbacks.
  • Real-time increments: As new incoming friend requests arrive, increment the badge count dynamically via onFriendApplicationAdded: in OIMFriendshipListener (see Retrieve received friend requests).