LCIMClient

Objective-C

@interface LCIMClient : NSObject

Swift

class LCIMClient : NSObject

IM Client.

  • Set up connecting timeout, default is 60 seconds.

    Declaration

    Objective-C

    + (void)setTimeoutIntervalInSeconds:(NSTimeInterval)seconds;

    Swift

    class func setTimeoutIntervalInSeconds(_ seconds: TimeInterval)

    Parameters

    seconds

    The interval of timeout.

  • The delegate for LCIMClientDelegate.

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) id<LCIMClientDelegate> delegate;

    Swift

    weak var delegate: LCIMClientDelegate? { get set }
  • The delegate for LCIMSignatureDataSource.

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) id<LCIMSignatureDataSource> signatureDataSource;
  • The ID of this client.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSString *_Nonnull clientId;

    Swift

    var clientId: String { get }
  • The LCUser of this client.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) LCUser *user;

    Swift

    var user: LCUser? { get }
  • tag

    The tag of this client.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *tag;

    Swift

    var tag: String? { get }
  • The current status of this client, see LCIMClientStatus.

    Declaration

    Objective-C

    @property (nonatomic, readonly) LCIMClientStatus status;

    Swift

    var status: LCIMClientStatus { get }
  • The control switch for message query cache, default is true.

    Declaration

    Objective-C

    @property (nonatomic) BOOL messageQueryCacheEnabled;

    Swift

    var messageQueryCacheEnabled: Bool { get set }
  • Unavailable

    Undocumented

    Declaration

    Objective-C

    + (instancetype)new NS_UNAVAILABLE;
  • Unavailable

    Undocumented

    Declaration

    Objective-C

    - (instancetype)init NS_UNAVAILABLE;
  • Initializing with an ID.

    Declaration

    Objective-C

    - (nullable instancetype)initWithClientId:(nonnull NSString *)clientId
                                        error:(NSError *_Nullable *_Nullable)error;

    Swift

    init(clientId: String) throws

    Parameters

    clientId

    The length of the ID should in range [1, 64].

    error

    Throws exception when error occurred.

  • Initializing with an ID and a tag.

    Declaration

    Objective-C

    - (nullable instancetype)initWithClientId:(nonnull NSString *)clientId
                                          tag:(NSString *_Nullable)tag
                                        error:(NSError *_Nullable *_Nullable)error;

    Swift

    init(clientId: String, tag: String?) throws

    Parameters

    clientId

    The length of the ID should in range [1, 64].

    tag

    Using a tag to specify the context, @"default" is reserved.

    error

    Throws exception when error occurred.

  • Initializing with an LCUser.

    Declaration

    Objective-C

    - (nullable instancetype)initWithUser:(nonnull LCUser *)user
                                    error:(NSError *_Nullable *_Nullable)error;

    Swift

    init(user: LCUser) throws

    Parameters

    user

    The user should have logged in.

    error

    Throws exception when error occurred.

  • Initializing with an LCUser and a tag.

    Declaration

    Objective-C

    - (nullable instancetype)initWithUser:(nonnull LCUser *)user
                                      tag:(NSString *_Nullable)tag
                                    error:(NSError *_Nullable *_Nullable)error;

    Swift

    init(user: LCUser, tag: String?) throws

    Parameters

    user

    The user should have logged in.

    tag

    Using a tag to specify the context, @"default" is reserved.

    error

    Throws exception when error occurred.

  • Open this client before using instant messaging service, this action use LCIMClientOpenOptionForceOpen as default open option.

    Declaration

    Objective-C

    - (void)openWithCallback:(nonnull void (^)(BOOL, NSError *_Nullable))callback;

    Swift

    func open(callback: @escaping (Bool, Error?) -> Void)

    Parameters

    callback

    The result callback.

  • Open this client before using instant messaging service

    Declaration

    Objective-C

    - (void)openWithOption:(LCIMClientOpenOption)openOption
                  callback:(nonnull void (^)(BOOL, NSError *_Nullable))callback;

    Swift

    func open(with openOption: LCIMClientOpenOption, callback: @escaping (Bool, Error?) -> Void)

    Parameters

    openOption
    callback

    The result callback.

  • Close this client.

    Declaration

    Objective-C

    - (void)closeWithCallback:(nonnull void (^)(BOOL, NSError *_Nullable))callback;

    Swift

    func close(callback: @escaping (Bool, Error?) -> Void)

    Parameters

    callback

    The result callback.

  • Create a Normal Conversation. Default is a Normal Unique Conversation.

    Declaration

    Objective-C

    - (void)createConversationWithClientIds:(nonnull NSArray<NSString *> *)clientIds
                                   callback:(nonnull void (^)(
                                                LCIMConversation *_Nullable,
                                                NSError *_Nullable))callback;

    Swift

    func createConversation(withClientIds clientIds: [String], callback: @escaping (LCIMConversation?, Error?) -> Void)

    Parameters

    clientIds

    The set of client ID. it’s the members of the conversation which will be created. the initialized members always contains current client’s ID. if the created conversation is unique, and server has one unique conversation with the same members, that unique conversation will be returned.

    callback

    Result callback.

  • Create a Normal Conversation. Default is a Normal Unique Conversation.

    Declaration

    Objective-C

    - (void)
        createConversationWithClientIds:(nonnull NSArray<NSString *> *)clientIds
                                 option:(LCIMConversationCreationOption *_Nullable)
                                            option
                               callback:
                                   (nonnull void (^)(LCIMConversation *_Nullable,
                                                     NSError *_Nullable))callback;

    Swift

    func createConversation(withClientIds clientIds: [String], option: LCIMConversationCreationOption?, callback: @escaping (LCIMConversation?, Error?) -> Void)

    Parameters

    clientIds

    The set of client ID. it’s the members of the conversation which will be created. the initialized members always contains current client’s ID. if the created conversation is unique, and server has one unique conversation with the same members, that unique conversation will be returned.

    option
    callback

    Result callback.

  • Create a Chat Room.

    Declaration

    Objective-C

    - (void)createChatRoomWithCallback:
        (nonnull void (^)(LCIMChatRoom *_Nullable, NSError *_Nullable))callback;

    Swift

    func createChatRoom(callback: @escaping (LCIMChatRoom?, Error?) -> Void)

    Parameters

    callback

    Result callback.

  • Create a Chat Room.

    Declaration

    Objective-C

    - (void)createChatRoomWithOption:
                (LCIMConversationCreationOption *_Nullable)option
                            callback:(nonnull void (^)(LCIMChatRoom *_Nullable,
                                                       NSError *_Nullable))callback;

    Swift

    func createChatRoom(with option: LCIMConversationCreationOption?, callback: @escaping (LCIMChatRoom?, Error?) -> Void)

    Parameters

    option
    callback

    Result callback.

  • Create a Temporary Conversation. Temporary Conversation is unique in it’s Life Cycle.

    Declaration

    Objective-C

    - (void)createTemporaryConversationWithClientIds:
                (nonnull NSArray<NSString *> *)clientIds
                                            callback:
                                                (nonnull void (^)(
                                                    LCIMTemporaryConversation
                                                        *_Nullable,
                                                    NSError *_Nullable))callback;

    Swift

    func createTemporaryConversation(withClientIds clientIds: [String], callback: @escaping (LCIMTemporaryConversation?, Error?) -> Void)

    Parameters

    clientIds

    The set of client ID. it’s the members of the conversation which will be created. the initialized members always contains this client’s ID.

    callback

    Result callback.

  • Create a Temporary Conversation. Temporary Conversation is unique in it’s Life Cycle.

    Declaration

    Objective-C

    - (void)createTemporaryConversationWithClientIds:
                (nonnull NSArray<NSString *> *)clientIds
                                              option:(LCIMConversationCreationOption
                                                          *_Nullable)option
                                            callback:
                                                (nonnull void (^)(
                                                    LCIMTemporaryConversation
                                                        *_Nullable,
                                                    NSError *_Nullable))callback;

    Swift

    func createTemporaryConversation(withClientIds clientIds: [String], option: LCIMConversationCreationOption?, callback: @escaping (LCIMTemporaryConversation?, Error?) -> Void)

    Parameters

    clientIds

    The set of client ID. it’s the members of the conversation which will be created. the initialized members always contains this client’s ID.

    option
    callback

    Result callback.

  • Get a Exist Conversation Retained by this Client. Thread-safe & Sync.

    Declaration

    Objective-C

    - (LCIMConversation *_Nullable)conversationForId:
        (nonnull NSString *)conversationId;

    Swift

    func conversation(forId conversationId: String) -> LCIMConversation?

    Parameters

    conversationId

    conversationId

    Return Value

    if the Conversation Exist, return the Instance; if not, return nil.

  • Get Conversations Retained by this Client. Thread-safe & Async.

    Declaration

    Objective-C

    - (void)getConversationsFromMemoryWith:
                (nonnull NSArray<NSString *> *)conversationIds
                                  callback:
                                      (nonnull void (^)(NSArray<LCIMConversation *>
                                                            *_Nullable))callback;

    Swift

    func getConversationsFromMemory(with conversationIds: [String], callback: @escaping ([LCIMConversation]?) -> Void)

    Parameters

    conversationIds

    ID array.

    callback

    Result.

  • Remove Conversations Retained by this Client. Thread-safe & Async.

    Declaration

    Objective-C

    - (void)removeConversationsInMemoryWith:
                (nonnull NSArray<NSString *> *)conversationIds
                                   callback:(nonnull void (^)(void))callback;

    Swift

    func removeConversationsInMemory(with conversationIds: [String], callback: @escaping () -> Void)

    Parameters

    conversationIds

    Array of conversation’s ID

    callback

    Result of Callback, always means success.

  • Remove all Conversations Retained by this Client. Thread-safe & Async.

    Declaration

    Objective-C

    - (void)removeAllConversationsInMemoryWith:(nonnull void (^)(void))callback;

    Swift

    func removeAllConversationsInMemory(_ callback: @escaping () -> Void)

    Parameters

    callback

    Result of Callback, always means success.

  • Undocumented

    Declaration

    Objective-C

    - (LCIMConversation * _Nullable)conversationWithKeyedConversation:(LCIMKeyedConversation *)keyedConversation;

    Swift

    func conversation(with keyedConversation: LCIMKeyedConversation) -> LCIMConversation?
  • Create a new conversation query.

    Declaration

    Objective-C

    - (nonnull LCIMConversationQuery *)conversationQuery;

    Swift

    func conversationQuery() -> LCIMConversationQuery
  • Undocumented

    Declaration

    Objective-C

    - (void)queryOnlineClientsInClients:(nonnull NSArray<NSString *> *)clients
                               callback:
                                   (nonnull void (^)(NSArray<NSString *> *_Nullable,
                                                     NSError *_Nullable))callback;

    Swift

    func queryOnlineClients(inClients clients: [String], callback: @escaping ([String]?, Error?) -> Void)