如何通过 objc 和 ios 的 XMPPFramework 发送消息?
现在真的很烦我。我需要使用一些自定义 XML 构建自定义方法并将其发送到特定的 JID。
有任何想法吗?
谢谢你。
如何通过 objc 和 ios 的 XMPPFramework 发送消息?
现在真的很烦我。我需要使用一些自定义 XML 构建自定义方法并将其发送到特定的 JID。
有任何想法吗?
谢谢你。
NSXMLElement *body = [NSXMLElement elementWithName:@"body"];
[body setStringValue:textvalue];
NSXMLElement *message = [NSXMLElement elementWithName:@"message"];
[message addAttributeWithName:@"type" stringValue:@"chat"];
[message addAttributeWithName:@"to" stringValue:[jid full]];
[message addChild:body];
[[self xmppStream] sendElement:message];
试试这个