XMPP室邀请朋友IOS

时间:2013-11-22 06:34:51

标签: ios iphone objective-c ios6 xmpp

我在ios中使用XMPP Framework。我如何邀请其他用户进行群聊?

 [xmppRoom1 inviteUser:[XMPPJID jidWithString:@"abc@domain.com"] withMessage:@"Come Join me"];

2 个答案:

答案 0 :(得分:1)

您可以在MUC中逐个邀请多个用户:

for (int contactIndex = 0; contactIndex <contactsToInviteArray.count; contactIndex++)
{
    NSString * inviteUserJID = [NSString stringWithFormat:@"%@@%@",[contactsToInviteArray enter code hereobjectAtIndex:contactIndex], SERVER_NAME];
    [xmppRoom1 inviteUser:[XMPPJID jidWithString:inviteUserJID] withMessage:@"Come Join me"];

}

答案 1 :(得分:0)

此代码适用于我。

XMPPRoomMemoryStorage *roomMemoryStorage = [[XMPPRoomMemoryStorage alloc] init];
XMPPRoom *xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:roomMemoryStorage jid:[XMPPJID jidWithString:@"Groupname"] dispatchQueue:dispatch_get_main_queue()];
[xmppRoom activate:xmppStream];
[xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
[xmppRoom inviteUser:[XMPPJID jidWithString:@""] withMessage:[NSString stringWithFormat:@"Come Join me"] listusers:@" array with list of users JID "];