通过XMPPFramework for iOS发送消息

Tho*_*son 7 iphone cocoa-touch xmppframework

如何通过XMPPFramework为objc和ios发送消息?

它现在真的让我烦恼.我需要使用一些自定义XML构建自定义方法并将其发送到特定的JID.

有任何想法吗?

谢谢.

har*_*alb 13

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];
Run Code Online (Sandbox Code Playgroud)

试试这个