如何在iphone中使用Xmpp将消息发送到特定的电子邮件id
我正在使用Xmpp尝试应用程序。我创建了登录页面EmailID、密码、,hostnametalk.google.com。这是我创建的第一个页面。按下登录按钮后,如果成功,我们将进入下一个视图,然后我们将获得另一个视图,其中包括两个文本视图,一个是emaild,用于发送消息,另一个是message,用于发送消息,单击发送按钮,我必须发送消息..我的主要问题是我成功登录,但在我无法将消息发送到该邮件id之后..有人能帮我完成此任务吗?代码如下 多谢各位 少女的 这里, 使用此代码将消息发送到域上的任何JID如何在iphone中使用Xmpp将消息发送到特定的电子邮件id,iphone,xmpp,Iphone,Xmpp,我正在使用Xmpp尝试应用程序。我创建了登录页面EmailID、密码、,hostnametalk.google.com。这是我创建的第一个页面。按下登录按钮后,如果成功,我们将进入下一个视图,然后我们将获得另一个视图,其中包括两个文本视图,一个是emaild,用于发送消息,另一个是message,用于发送消息,单击发送按钮,我必须发送消息..我的主要问题是我成功登录,但在我无法将消息发送到该邮件id之后..有人能帮我完成此任务吗?代码如下 多谢各位 少女的 这里, 使用此代码将消息发送到域上的任
- (void)sendMessage:(NSString *)userId
{
NSString *messageStr = @"Hello...";
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:userId];
[message addChild:body];
[[self xmppStream] sendElement:message];
}
}
- (void)sendMessage:(NSString *)userId
{
NSString *messageStr = @"Hello...";
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:userId];
[message addChild:body];
[[self xmppStream] sendElement:message];
}
}