问题
How do I send a message through the XMPPFramework for objc and ios?
Its really bugging me now. I need to build a custom method with some custom XML and send it to a specific JID.
Any ideas?
Thank you.
回答1:
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];
try this
来源:https://stackoverflow.com/questions/4460823/send-a-message-via-xmppframework-for-ios