Browse SDKs · iOS
Platform
SDKsiOS

Retrieve subscribed user status

Retrieve an online-status snapshot for subscribed users with OpenIM iOS SDK.

Copy

Query the current real-time presence snapshot for all active subscribed users using getSubscribeUsersStatusWithOnSuccess:onFailure:. This method accepts no parameters and leaves the active subscription roster unchanged.

Code example

[[OIMManager manager] getSubscribeUsersStatusWithOnSuccess:^(NSArray<OIMUserStatusInfo *> *states) {
    [presenceStore mergeStates:states];
} onFailure:^(NSInteger code, NSString *message) {
    NSLog(@"getSubscribeUsersStatus failed: %ld %@", (long)code, message);
}];

Use this method to reconcile presence records upon network reconnection or view foregrounding.

Return value

The onSuccess callback delivers an array of OIMUserStatusInfo objects capturing the latest online status and platform lists for all actively subscribed users.

State changes after the call

  • Local state merge: Merge presence records into local state collections using userID as the unique entity key.
  • Asynchronous event tracking: This query returns a point-in-time snapshot and does not emit delegate callbacks. Ongoing incremental status changes continue to arrive via onUserStatusChanged: in OIMUserListener (see Subscribe to user status).