0
我在ios中使用XMPP框架。我如何邀請其他用戶進行羣聊?XMPP房間邀請朋友IOS
[xmppRoom1 inviteUser:[XMPPJID jidWithString:@"[email protected]"] withMessage:@"Come Join me"];
我在ios中使用XMPP框架。我如何邀請其他用戶進行羣聊?XMPP房間邀請朋友IOS
[xmppRoom1 inviteUser:[XMPPJID jidWithString:@"[email protected]"] withMessage:@"Come Join me"];
您可以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"];
}
此代碼對我的作品。
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 "];
在調用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]; –