【问题标题】:How to add user to existing ROOM in XMPP iOS?如何将用户添加到 XMPP iOS 中的现有 ROOM?
【发布时间】:2016-12-27 05:22:43
【问题描述】:

我在 XMPP 聊天模块中工作。我昨天创建了组,现在我想在这个组中添加更多成员。在现有组中添加成员的过程是什么。

这是我创建组的代码:

XMPPJID *roomJID = [XMPPJID jidWithString:@"xyz@conference.abc"];
XMPPRoomMemoryStorage *roomMemoryStorage = [[XMPPRoomMemoryStorage alloc] init];
XMPPRoom *newxmppRoom = [[XMPPRoom alloc]
            initWithRoomStorage:roomMemoryStorage
            jid:roomJID
            dispatchQueue:dispatch_get_main_queue()];
[newxmppRoom activate:xmppStream];
[newxmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
[newxmppRoom joinRoomUsingNickname:@"MY_NICKNAME" history:nil];

是不是每次我想在房间里添加用户时都必须写上面的代码?

【问题讨论】:

    标签: ios add xmppframework chatroom invite


    【解决方案1】:

    是的,所有这些代码加入房间所必需的。要邀请用户,您应该使用方法:

    XMPPJID * userID = [XMPPJID jidWithString:user.entityID];
    [room inviteUser:userID withMessage:@""];
    

    然后在回调中:

    - (void)xmppMUC:(XMPPMUC *)sender roomJID:(XMPPJID *)roomJID didReceiveInvitation:(XMPPMessage *)message {
        // User your code here to join
    }
    

    【讨论】:

      猜你喜欢
      • 2013-09-04
      • 1970-01-01
      • 1970-01-01
      • 2015-01-06
      • 1970-01-01
      • 1970-01-01
      • 2022-12-04
      • 2013-07-17
      • 1970-01-01
      相关资源
      最近更新 更多