【发布时间】:2015-04-20 12:46:09
【问题描述】:
我正在 iPhone 中开发一个群聊应用程序,我想在其中实现此功能:管理员可以删除/踢任何参与者。并且参与者必须收到管理员已将其从该组中删除的通知。
我尝试了下面的代码,但没有成功:
XMPPPresence *presence = [XMPPPresence presenceWithType:@"unavailable"];
[presence addAttributeWithName:@"from" stringValue:[[DatingUserDefaults sharedDefaults] getGroupName]];
[presence addAttributeWithName:@"to" stringValue:[[DatingUserDefaults sharedDefaults] getUsername]];
[xmppStream sendElement:presence];
我在 Google 上搜索并知道我必须在 Objective-C 中生成以下格式:
<presence
from='harfleur@chat.shakespeare.lit/pistol'
to='pistol@shakespeare.lit/harfleur'
type='unavailable'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='none' role='none'>
<actor nick='Fluellen'/>
<reason>Avaunt, you cullion!</reason>
</item>
<status code='307'/>
</x>
</presence>
有人知道怎么做吗?
【问题讨论】:
-
您对此有什么解决方案吗?我也面临同样的问题。