Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在iphone中使用Xmpp将消息发送到特定的电子邮件id_Iphone_Xmpp - Fatal编程技术网

如何在iphone中使用Xmpp将消息发送到特定的电子邮件id

如何在iphone中使用Xmpp将消息发送到特定的电子邮件id,iphone,xmpp,Iphone,Xmpp,我正在使用Xmpp尝试应用程序。我创建了登录页面EmailID、密码、,hostnametalk.google.com。这是我创建的第一个页面。按下登录按钮后,如果成功,我们将进入下一个视图,然后我们将获得另一个视图,其中包括两个文本视图,一个是emaild,用于发送消息,另一个是message,用于发送消息,单击发送按钮,我必须发送消息..我的主要问题是我成功登录,但在我无法将消息发送到该邮件id之后..有人能帮我完成此任务吗?代码如下 多谢各位 少女的 这里, 使用此代码将消息发送到域上的任

我正在使用Xmpp尝试应用程序。我创建了登录页面EmailID、密码、,hostnametalk.google.com。这是我创建的第一个页面。按下登录按钮后,如果成功,我们将进入下一个视图,然后我们将获得另一个视图,其中包括两个文本视图,一个是emaild,用于发送消息,另一个是message,用于发送消息,单击发送按钮,我必须发送消息..我的主要问题是我成功登录,但在我无法将消息发送到该邮件id之后..有人能帮我完成此任务吗?代码如下

多谢各位 少女的

这里,

使用此代码将消息发送到域上的任何JID

- (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];



}
}