NIMHistoryMessageSearchOption Class Reference

Inherits from NSObject
Declared in NIMMessageSearchOption.h

Overview

Retrieve history messages stored on the server

  startTime

The start time

@property (nonatomic, assign) NSTimeInterval startTime

Discussion

The start time

The start time for search. If unspecified, pass in 0.

Declared In

NIMMessageSearchOption.h

  limit

Search limit

@property (nonatomic, assign) NSUInteger limit

Discussion

Search limit

The maximum of 100 messages is allowed

Declared In

NIMMessageSearchOption.h

  endTime

The end time for search. This parameter is invalid for chat room sessions.

@property (nonatomic, assign) NSTimeInterval endTime

Discussion

The end time for search. This parameter is invalid for chat room sessions.

The earliest time. If unspecified, pass in 0.

Declared In

NIMMessageSearchOption.h

  currentMessage

The reference message for search. The returned message result will not contain this message. This parameter is invalid for chat room sessions. The parameter has a lower priority than serverId

@property (nullable, nonatomic, strong) NIMMessage *currentMessage

Discussion

The reference message for search. The returned message result will not contain this message. This parameter is invalid for chat room sessions. The parameter has a lower priority than serverId

The earliest time. If unspecified, pass in nil.

Declared In

NIMMessageSearchOption.h

  serverId

The reference message for search. The returned message result will not contain this the message with the serverId. This parameter is invalid for chat room sessions. The parameter has a higher priority than the serverId of currentMessage

@property (nullable, nonatomic, copy) NSString *serverId

Discussion

The reference message for search. The returned message result will not contain this the message with the serverId. This parameter is invalid for chat room sessions. The parameter has a higher priority than the serverId of currentMessage

The earliest time. If unspecified, pass in nil.

Declared In

NIMMessageSearchOption.h

  order

Search order.

@property (nonatomic, assign) NIMMessageSearchOrder order

Discussion

Search order.

Declared In

NIMMessageSearchOption.h

  sync

Specify whether to sync with the database. This parameter is invalid for chat room sessions.

@property (nonatomic, assign) BOOL sync

Discussion

Specify whether to sync with the database. This parameter is invalid for chat room sessions.

SDK deletes message in two ways: marked deletion and complete deletion. For more information, see NIMDeleteMessagesOption. If messages are marked for deletion locally, messages are still stored locally but marked with a special mark, and writing to the database after synchronization will fail. Only messages that are not stored locally can be stored in the database using the sync flag

Declared In

NIMMessageSearchOption.h

  messageTypes

Message type for search @discusssion message types. The default value is nil and all types are searched. Once this field is specified, the sync field will become invalid, and the query result will not be written to the database. The field must be synchronized by setting syncMessageTypes.

@property (nonatomic, copy) NSArray<NSNumber*> *messageTypes

Discussion

Message type for search @discusssion message types. The default value is nil and all types are searched. Once this field is specified, the sync field will become invalid, and the query result will not be written to the database. The field must be synchronized by setting syncMessageTypes.

Declared In

NIMMessageSearchOption.h

  syncMessageTypes

Specify whether to sync data of specified types with the database. This parameter is invalid for chat room sessions.

@property (nonatomic, assign) BOOL syncMessageTypes

Discussion

Specify whether to sync data of specified types with the database. This parameter is invalid for chat room sessions.

SDK deletes message in two ways: marked deletion and complete deletion. For more information, see NIMDeleteMessagesOption. If messages are marked for deletion locally, messages are still stored locally but marked with a special mark, and writing to the database after synchronization will fail. Only messages that are not stored locally can be stored in the database using the syncMessageTypes flag

Declared In

NIMMessageSearchOption.h

  customFilter

Custom messages mask @discusssion Custom external filter for history messages YES is returned if the message is filtered, and no callback will be made if it is not stored in the database. If NO is returned, the message is normally stored. The callback is in the internal worker thread. Note that do not perform blocking or time-consuming operations in this callback to prevent affecting the internal message processing flow.

@property (nullable, nonatomic, strong) NIMHistoryMessageFilterBlock customFilter

Discussion

Custom messages mask @discusssion Custom external filter for history messages YES is returned if the message is filtered, and no callback will be made if it is not stored in the database. If NO is returned, the message is normally stored. The callback is in the internal worker thread. Note that do not perform blocking or time-consuming operations in this callback to prevent affecting the internal message processing flow.

Declared In

NIMMessageSearchOption.h

  createRecentSessionIfNotExists

Synchronize the cloud message to the local storage. If the latest session where the message is located does not exist, automatically create the session. The default value is NO.

@property (nonatomic, assign) BOOL createRecentSessionIfNotExists

Discussion

Synchronize the cloud message to the local storage. If the latest session where the message is located does not exist, automatically create the session. The default value is NO.

Declared In

NIMMessageSearchOption.h