Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send a message via XMPPFramework for iOS

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.

like image 341
Thomas Clayson Avatar asked Dec 16 '10 12:12

Thomas Clayson


1 Answers

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

like image 195
harshalb Avatar answered Nov 07 '22 03:11

harshalb