求助,xmppframework聊天室的创建

2025-05-18 17:40:02
推荐回答(1个)
回答(1):

你好,我在别的地方也看见你的问题,我来回答:

XMPPRoomCoreDataStorage *rosterstorage = [[XMPPRoomCoreDataStorage alloc] init];
room = [[XMPPRoom alloc] initWithRoomStorage:rosterstorage jid:[XMPPJID jidWithString:@"xx@xxx.xxx.xx.xxx"] dispatchQueue:dispatch_get_main_queue()];

XMPPStream *stream = [self xmppStream];
[room activate:stream];

if (room) {

}

if ([room preJoinWithNickname:@"smith"])
{
NSLog(@"room created");
[room joinRoomUsingNickname:@"smith" history:nil];
}

[rosterstorage release];

[room addDelegate:self delegateQueue:dispatch_get_main_queue()];

氏你的采纳是我前进的动力,还有不懂的地方,请继续追问。