Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/101.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
Robbiehanson xmpp iOS框架不接收聊天信息_Ios_Objective C_Xmpp_Xmppframework - Fatal编程技术网

Robbiehanson xmpp iOS框架不接收聊天信息

Robbiehanson xmpp iOS框架不接收聊天信息,ios,objective-c,xmpp,xmppframework,Ios,Objective C,Xmpp,Xmppframework,试图用robbiehanson xmpp创建一个非常简单的概念验证iOS xmpp应用程序,只需要能够发送和接收消息和花名册数据。我可以成功地进行身份验证并发送消息,但当用户尝试响应我的消息时,我不会收到它们。我实现了didReceiveMessage委托方法,如下所示: -(void)xmppStream:(XMPPStream *)sender didReceiveMessage:(XMPPMessage *)message { NSLog(@"incoming message: %

试图用robbiehanson xmpp创建一个非常简单的概念验证iOS xmpp应用程序,只需要能够发送和接收消息和花名册数据。我可以成功地进行身份验证并发送消息,但当用户尝试响应我的消息时,我不会收到它们。我实现了didReceiveMessage委托方法,如下所示:

-(void)xmppStream:(XMPPStream *)sender didReceiveMessage:(XMPPMessage *)message {
    NSLog(@"incoming message: %@", message);
}
但是我从来没有收到过这个日志。如果我使用与xmpp服务器通信的现有web应用程序或android应用程序登录,我会收到这些消息,因此我倾向于认为它们的格式正确。是否有一个模块需要添加到XMPPStream以接收消息?我像这样设置流(为了安全起见,一些字符串值已经更改,等等):

然后在xmppStreamDidConnect方法中,我这样做是为了进行身份验证

NSString *myPassword = @"password";
NSError *error = nil;

[stream authenticateWithPassword:myPassword error:&error]
当我发送信息时,我使用以下代码段:

 MPPJID* recipient = [XMPPJID jidWithString:@"user@domain.com"];
XMPPMessage* message = [[XMPPMessage alloc] initWithType:@"chat" to:recipient];
[message addBody:@"hello world"];

[stream sendElement: message];

我想有一件简单的事情我错过了,以前使用过它的人可以马上向我指出。我准备提供其他信息,如果有必要解决这个问题

我只需要广播我的存在,然后我就可以接收信息了

我将这些行添加到streamDidAuthenticate方法中

XMPPPresence *presence = [XMPPPresence presence];
[sender sendElement:presence];
XMPPPresence *presence = [XMPPPresence presence];
[sender sendElement:presence];