2013-11-22 59 views

回答

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"]; 

} 
+0

在調用invite函數之前,我們是否需要執行此代碼? _xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:xmppRoomCoreDataStorage jid:groupJabId dispatchQueue:dispatch_get_main_queue()]; [_xmppRoom activate:[[CLXMPPDelegate sharedManager] xmppStream]]; [_xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()]; NSXMLElement * history = [NSXMLElement elementWithName:@「history」]; [history addAttributeWithName:@「maxstanzas」stringValue:@「0」]; [_xmppRoom joinRoomUsingNickname:userMO.closrr_id history:nil]; –

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 "];