I’m trying for group chat in iphone,am able to use single chat successfully.
I have created new room using following code successfully.
XMPPRoomCoreDataStorage *rosterstorage = [[XMPPRoomCoreDataStorage alloc] init];
XMPPRoom *xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:rosterstorage jid:[XMPPJID jidWithString:@"viratsroom@conference.praveens-mac-mini.local"] dispatchQueue:dispatch_get_main_queue()];
[xmppRoom activate:[[self appDelegate] xmppStream]];
if ([xmppRoom preJoinWithNickname:@"viratsRoom"]) {
NSLog(@"room created");
[xmppRoom joinRoomUsingNickname:@"viratsroom11" history:nil];
}
[xmppRoom fetchConfigurationForm];
[xmppRoom configureRoomUsingOptions:nil];
[xmppRoom addDelegate:[self appDelegate] delegateQueue:dispatch_get_main_queue()];
now under users in this group there is one user shown on openfire server which is correct.
my questions are,
1)where and how to handle invitation message to join group?
2)I have tried to join the same group made above by using following code
XMPPRoomCoreDataStorage *rosterstorage = [[XMPPRoomCoreDataStorage alloc] init];
XMPPRoom *xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:rosterstorage jid:[XMPPJID jidWithString:@"viratsroom@conference.praveens-mac-mini.local"] dispatchQueue:dispatch_get_main_queue()];
[xmppRoom activate:[[self appDelegate] xmppStream]];
[xmppRoom joinRoomUsingNickname:@"viratsroom11" history:nil];
[xmppRoom fetchConfigurationForm];
[xmppRoom configureRoomUsingOptions:nil];
[xmppRoom addDelegate:[self appDelegate] delegateQueue:dispatch_get_main_queue()];
the room name now is shown in my offline users list.
now users under this room on openfire server should increase to two as one more user has joined this room but it still shows only one previous user member.
Am I missing something? any mistake in code ? please help!
Thanks .
I got this,
Room wasnt configured properly hence all problems
calling this immediately after creating room doesnt work-
it takes a little time to create room after that u can configure the room.
🙂