我使用Smack lib。我需要发送此(Android):
<presence type='initialize' location_id='570' user_id='8942'/>.
在Xcode上:
XMPPPresence *presence = [XMPPPresence presence];
[presence addAttributeWithName:@"location_id" stringValue:[NSString stringWithFormat:@"%lu", (unsigned long)Settings.LocationID]];
[presence addAttributeWithName:@"user_id" stringValue:[NSString stringWithFormat:@"%lu", (unsigned long)Settings.UserID]];
[presence addAttributeWithName:@"type" stringValue:@"initialize"];
[_xmppStream sendElement:presence];
答案 0 :(得分:0)
你做不到。没有为在线状态的'type'属性定义值'initialize'。也不是'location_id'或'user_id'。如果要将自定义信息添加到节,请使用扩展元素:
<presence ...>
<myExtension xmlns='myns'>
<initialize location_id='570' user_id='8942'/>
</myExtension>
</presence>