SDKsiOS
Retrieve the unhandled friend-request count
Retrieve the number of unhandled friend requests on iOS.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
req | GetFriendApplicationUnhandledCountReq * | Yes | Request object specifying the cutoff timestamp. |
Request attributes (GetFriendApplicationUnhandledCountReq)
| Parameter | Type | Required | Description |
|---|---|---|---|
time | NSInteger | Yes | Millisecond 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:inOIMFriendshipListener(see Retrieve received friend requests).
Was this page helpful?