SDKsiOS
Unsubscribe from user status
Stop subscribing to users’ online status with OpenIM iOS SDK.
Cancel active presence subscriptions for specific users using unsubscribeUsersStatus:onSuccess:onFailure:. Invoke this method when target users scroll out of the visible screen area, when navigating away from contact views, or during account teardown.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userIDs | NSArray<NSString *> * | Yes | List of user IDs to unsubscribe from. |
Code example
[[OIMManager manager] unsubscribeUsersStatus:userIDs
onSuccess:^(NSString *data) {
[presenceStore removeUserIDs:userIDs];
}
onFailure:^(NSInteger code, NSString *message) {
NSLog(@"unsubscribeUsersStatus failed: %ld %@", (long)code, message);
}];Unsubscribing from specific user IDs releases server quotas; it is distinct from removing the global OIMUserListener delegate.
Return value
The onSuccess callback signifies that OpenIMServer removed the specified users from the client's presence push roster. The server will cease pushing status notifications for these accounts to this client.
State changes after the call
- Local state merge: Remove the unsubscribed users from local active presence caches using
userIDas the unique entity key. - Subsequent subscriptions: To resume monitoring these users, invoke Subscribe to user status.
Was this page helpful?