目前我正在加入这样的聊天室。
_xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:_roomStorage
jid:roomJID
dispatchQueue:dispatch_get_main_queue()];
[_xmppRoom activate:[self appDelegate].xmppStream];
[_xmppRoom addDelegate:self
delegateQueue:dispatch_get_main_queue()];
NSString *profileId = @"123456";
NSString *myPassword = [[NSUserDefaults standardUserDefaults] stringForKey:@"userPassword"];
[[NSUserDefaults standardUserDefaults] synchronize];
[_xmppRoom joinRoomUsingNickname:profileId history:nil password:myPassword];
我想只检索指定数量的邮件作为聊天记录。目前它正在一次检索所有消息,这导致长聊天历史记录问题。
你能帮帮我吗?
答案 0 :(得分:0)
这是我找到的答案。您已发送指定了最大节的XML元素。
这是代码。
XMPPJID *roomJID = [XMPPJID jidWithString:roomID];
_xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:_roomStorage
jid:roomJID
dispatchQueue:dispatch_get_main_queue()];
[_xmppRoom activate:[self appDelegate].xmppStream];
[_xmppRoom addDelegate:self
delegateQueue:dispatch_get_main_queue()];
NSString *profileId = @"123456";
NSString *myPassword = [[NSUserDefaults standardUserDefaults] stringForKey:@"userPassword"];
[[NSUserDefaults standardUserDefaults] synchronize];
NSXMLElement *history = [NSXMLElement elementWithName:@"history"];
[history addAttributeWithName:@"maxstanzas" stringValue:@"10"];
[_xmppRoom joinRoomUsingNickname:profileId history:history password:myPassword];