gpt4 book ai didi

ios - 添加成员到 openfire 服务器

转载 作者:行者123 更新时间:2023-11-29 02:41:17 25 4
gpt4 key购买 nike

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

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

用于添加新成员,但新成员未添加到服务器。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;

如何添加成员(member)?

最佳答案

@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()];

用于添加新的联系人

[_xmppRoster addUser:jid withNickname:nickName];

收件人接受后,新联系人将反射(reflect)在您的烘焙商列表中

关于ios - 添加成员到 openfire 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25762125/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com