Browse SDKs · iOS
Platform
SDKsiOS

Retrieve typing status

Retrieve the current typing status of a specified member with OpenIM iOS SDK.

Copy

Invoke getInputstates:userID:onSuccess:onFailure: on OIMManager to check whether a specific user is actively typing in a conversation, along with their active client platform identifiers:

Parameters

ParameterTypeRequiredDescription
conversationIDNSString *YesTarget conversation identifier.
userIDNSString *YesUser ID of the target member being queried.
onSuccessvoid (^)(NSArray<NSNumber *> * _Nullable platformIDs)YesSuccess callback returning an array of active platform ID numbers.
onFailureOIMFailureCallbackYesFailure callback returning error code code and descriptive message msg.

Code example

[[OIMManager manager] getInputstates:conversationID
                              userID:memberUserID
                           onSuccess:^(NSArray<NSNumber *> * _Nullable platformIDs) {
    // Check if member is actively typing based on platform array emptiness
    [self setTyping:platformIDs.count > 0 userID:memberUserID];
}
                           onFailure:^(NSInteger code, NSString * _Nullable msg) {
    // Handle query failure
}];

Return value

The onSuccess callback delivers an array of platform ID numbers (NSArray<NSNumber *> *). A non-empty array indicates that the user is actively typing; an empty array indicates that typing has stopped.

State changes after the call

  1. Snapshot nature: This query returns an instantaneous snapshot and does not trigger typing event listeners.
  2. Polling considerations: Avoid frequent polling across all members in large group chats. Typically invoke this query upon entering a conversation or reconnecting to calibrate state. Subsequent live changes are pushed via the listener detailed in Report typing status.