gpt4 book ai didi

ios - XMPPFramework - 如何获取在线和离线好友列表?

转载 作者:行者123 更新时间:2023-11-28 20:00:09 28 4
gpt4 key购买 nike

如何在 iOS 中使用 XMPPFramework 获取在线和离线好友列表?

我想向用户发送好友请求。那么我该如何实现呢?有人可以为我分享一些示例代码吗?

谢谢。

最佳答案

通过使用这些方法,您将收到整个用户上线/下线、添加、删除、更新等的通知。通过使用这些方法,您可以更新您的联系人列表

- (void)xmppRoster:(XMPPRosterMemoryStorage *)sender didAddUser:(XMPPUserMemoryStorageObject *)user

- (void)xmppRoster:(XMPPRosterMemoryStorage *)sender didUpdateUser:(XMPPUserMemoryStorageObject *)user

- (void)xmppRoster:(XMPPRosterMemoryStorage *)sender didRemoveUser:(XMPPUserMemoryStorageObject *)user

- (void)xmppRoster:(XMPPRosterMemoryStorage *)sender
didAddResource:(XMPPResourceMemoryStorageObject *)resource
withUser:(XMPPUserMemoryStorageObject *)user

- (void)xmppRoster:(XMPPRosterMemoryStorage *)sender
didUpdateResource:(XMPPResourceMemoryStorageObject *)resource
withUser:(XMPPUserMemoryStorageObject *)user

- (void)xmppRoster:(XMPPRosterMemoryStorage *)sender
didRemoveResource:(XMPPResourceMemoryStorageObject *)resource
withUser:(XMPPUserMemoryStorageObject *)user

//添加好友

- (void)addContactWithUserName:(NSString *)userName andNickName:(NSString *)nickName;
{
if(userName)
{
XMPPJID *jid = [XMPPJID jidWithString:[NSString stringWithFormat:@"%@@%@",userName,self.hostName]];
if(nickName)
{
[_xmppRoster addUser:jid withNickname:nickName];
}
else
{
[_xmppRoster addUser:jid withNickname:nil];
}
}
else
{
NSLog(@"missing userName");
}
}

关于ios - XMPPFramework - 如何获取在线和离线好友列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24522526/

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