• (void)tomQueryMessagesWithLimit {
    // Tom 创建了一个 client,用自己的名字作为 clientId
    self.client = [[AVIMClient alloc] initWithClientId:@"Tom"];
// Tom 打开 client
[self.client openWithCallback:^(BOOL succeeded, NSError *error) {
    // Tom 创建查询会话的 query
    AVIMConversationQuery *query = [self.client conversationQuery];
    // Tom 获取 id 为 2f08e882f2a11ef07902eeb510d4223b 的会话
    [query getConversationById:@"2f08e882f2a11ef07902eeb510d4223b" callback:^(AVIMConversation *conversation, NSError *error) {
        // 查询对话中最后 10 条消息
        [conversation queryMessagesWithLimit:10 callback:^(NSArray *objects, NSError *error) {
            NSLog(@"查询成功!");
        }];
    }];
}];

}

可以给这个查询添加一个条件不? [conversation queryMessagesWithLimit:10 callback:^(NSArray *objects, NSError *error) {
NSLog(@"查询成功!");
}];
比如:用消息中自定义的某个字段来查询

你好,暂时不支持「用消息中自定义的某个字段来查询」。

iOS 最新版 SDK 支持用消息类型查询:

- (void)queryMediaMessagesFromServerWithType:(AVIMMessageMediaType)type  limit:(NSUInteger)limit
 fromMessageId:(NSString * _Nullable)messageId fromTimestamp:(int64_t)timestamp callback:(AVIMArrayResultBlock)callback;