【问题标题】:XMPP Room Invite Friend IOSXMPP房间邀请好友IOS
【发布时间】:2013-11-22 06:34:50
【问题描述】:

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

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

【问题讨论】:

    标签: ios iphone objective-c ios6 xmpp


    【解决方案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"];
    
    }
    

    【讨论】:

    • 在调用邀请函数之前我们是否需要执行此代码。 _xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:xmppRoomCoreDataStorage jid:groupJabId dispatchQueue:dispatch_get_main_queue()]; [_xmppRoom 激活:[[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];
    【解决方案2】:

    此代码对我有用。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-06
      • 1970-01-01
      • 2015-05-16
      • 1970-01-01
      • 2012-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多