I am creating a chat application using XMPP Framework in iphone. i could get received messages but i am not able to send a message. can any one give me solution for this?? <
- (void)sendMessage:(NSString *)msgContent
{
NSString *messageStr = textField.text;
if([messageStr length] > 0)
{
NSXMLElement *body = [NSXMLElement elementWithName:@"body"];
[body setStringValue:messageStr];
NSXMLElement *message = [NSXMLElement elementWithName:@"message"];
[message addAttributeWithName:@"type" stringValue:@"chat"];
[message addAttributeWithName:@"to" stringValue:[jid full]];
[message addChild:body];
[xmppStream sendElement:message];
}
}
use the above code in you chatViewcontroller ..it is working fine for me.