【问题标题】:Add member to openfire server将成员添加到 openfire 服务器
【发布时间】:2014-09-10 09:41:17
【问题描述】:

我正在为 mycchat 应用程序使用 openfirexmpp 框架。我正在使用

XMPPJID *newBuddy = [XMPPJID jidWithString:@"test@localhost"];
[self.xmppRoster addUser:newBuddy withNickname:@"user1"];

用于添加新成员但新成员未添加到server。 在 setupStream 方法代码中:

 xmppRosterStorage = [[XMPPRosterCoreDataStorage alloc] init];
 xmppRosterStorage = [[XMPPRosterCoreDataStorage alloc] initWithInMemoryStore];

xmppRoster = [[XMPPRoster alloc] initWithRosterStorage:xmppRosterStorage];
xmppRoster = [[XMPPRoster alloc] initWithRosterStorage:xmppRosterStorage
                                              dispatchQueue:dispatch_get_main_queue()];
[xmppRoster addDelegate:self delegateQueue:dispatch_get_main_queue()];
xmppRoster.autoFetchRoster = YES;
xmppRoster.autoAcceptKnownPresenceSubscriptionRequests = YES;

如何添加会员?

【问题讨论】:

    标签: ios xmpp openfire


    【解决方案1】:
    @property (nonatomic, readonly) XMPPStream *xmppStream;    
    @property (nonatomic, readonly) XMPPRoster *xmppRoster;
    @property (nonatomic, readonly) XMPPRosterMemoryStorage *xmppRosterStorage;
    

    setupStream 方法中设置XMPPStreamXMPPRoaster

    _xmppStream = [[XMPPStream alloc]init];
    _xmppStream.enableBackgroundingOnSocket = YES;
    _xmppRosterStorage = [[XMPPRosterMemoryStorage alloc] init];
    _xmppRoster = [[XMPPRoster alloc] initWithRosterStorage:_xmppRosterStorage];
    [_xmppRoster activate:_xmppStream];
    [_xmppRoster  addDelegate:self delegateQueue:dispatch_get_main_queue()];
    

    用于添加新的contact

    [_xmppRoster addUser:jid withNickname:nickName];
    

    收件人接受后,新联系人将反映在您的烘焙列表中

    【讨论】:

    • 如果您有任何疑问,请告诉我
    • 感谢您的回复。如何使用 registerWithElements 方法添加成员?
    • 添加会员意味着新用户注册,r8?
    • 添加联系人和新用户注册是不同的情况,我想你在这里询问将联系人添加到我们的漫游器
    • 我想在我的开火服务器中添加新用户,那么如何添加它们?哪种方法可以完成这项工作?
    猜你喜欢
    • 2012-01-01
    • 1970-01-01
    • 2016-08-21
    • 2013-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-27
    • 2015-07-12
    相关资源
    最近更新 更多