XMPPFramework - Создать XMPPRoom
Я пытался создать XMPPRoom с использованием приведенного ниже кода, я просмотрел различные примеры в Интернете, однако, когда я использую этот код, делегат xmppRoomDidCreate или xmppRoomDidJoin не вызывается. Я не уверен, что я здесь делаю не так?
PS: делегатов xmppStream действительно вызывают, он подключается и авторизуется, однако проблема в делегатах XMPPRoom ...
- (void)createChatRoom
{
NSString *jabberID = @"[email protected]";
self.xmppStream.hostName = @"testservice.com";
self.xmppStream = [[XMPPStream alloc]init];
[self.xmppStream addDelegate:self delegateQueue:dispatch_get_main_queue()];
[self.xmppStream setMyJID:[XMPPJID jidWithString:jabberID]];
NSError *error = nil;
if (![self.xmppStream connectWithTimeout:XMPPStreamTimeoutNone error:&error]) {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Error" message:[NSString stringWithFormat:@"Cannot connect to server %@",[error localizedDescription]] delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];
return;
}
// Configure xmppRoom
XMPPJID *roomJID = [XMPPJID jidWithString:@"[email protected]"];
XMPPRoomMemoryStorage *roomMemoryStorage = [[XMPPRoomMemoryStorage alloc] init];
XMPPRoom *xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:roomMemoryStorage
jid:roomJID
dispatchQueue:dispatch_get_main_queue()];
[xmppRoom activate:self.xmppStream];
[xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
}