在xmpp中同时进行单聊和群聊

时间:2014-01-21 10:53:10

标签: ios iphone objective-c xmpp openfire

在我的应用程序中,我的用户对用户单一聊天工作正常 但是,如果我将房间的邀请发送给任何用户,则单个聊天不起作用。

我还没有在应用中附加群组聊天代码。只需将Room的邀请发送给其他用户,然后创建单个聊天。

我错过了什么逻辑吗?

我创建和邀请的代码

XMPPRoomMemoryStorage * _roomMemory = [[XMPPRoomMemoryStorage alloc]init];
NSString* roomID = [NSString stringWithFormat:@"%@@conference.room",strGlobalRoomNameForLogin];
XMPPJID * roomJID = [XMPPJID jidWithString:roomID];
xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:_roomMemory jid:roomJID dispatchQueue:dispatch_get_main_queue()];

[xmppRoom activate:xmppStream];

[xmppRoom joinRoomUsingNickname:[NSString stringWithFormat:@"%@",strCureentUserName] history:nil];

//NSLog(@"strCureentUserName %@",strCureentUserName);

//.........inviting the Friend.......
for (int i=0; i<[arrUserName count];i++) {

    NSString *strInviteUserEmalid = [[arrUserName objectAtIndex:i] stringByReplacingOccurrencesOfString:@"@" withString:@"$"];
   // NSLog(@"strInviteUserEmalid %@",strInviteUserEmalid);

    [xmppRoom inviteUser:[XMPPJID jidWithString:[NSString stringWithFormat:@"%@@user",strInviteUserEmalid]] withMessage:@"Come Join me in this room"];
}

[xmppRoom fetchConfigurationForm];
[xmppRoom configureRoomUsingOptions:nil];

[xmppRoom addDelegate:_roomMemory delegateQueue:dispatch_get_main_queue()];

1 个答案:

答案 0 :(得分:0)

对于大量被邀请者,您可能会在服务器上遇到“业力”限制。尝试通过添加超时来减慢邀请。