I have been trying to create a XMPPRoom using the below mentioned code, i have looked at various examples online however when i use this code, the delegate xmppRoomDidCreate or xmppRoomDidJoin delegates doesn't get called. I'm not sure what am i doing wrong here?
PS: the delegates of xmppStream do get called, it gets connected and authorized however, the issue is XMPPRoom delegates...
- (void)createChatRoom
{
NSString *jabberID = @"abcxyz@testservice.com";
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:@"TestRoom@conference.testservice.com"];
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()];
}