Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.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
Ios Messenger无法从第一次尝试连接到XMPP服务器_Ios_Swift_Xmpp_Xmppframework - Fatal编程技术网

Ios Messenger无法从第一次尝试连接到XMPP服务器

Ios Messenger无法从第一次尝试连接到XMPP服务器,ios,swift,xmpp,xmppframework,Ios,Swift,Xmpp,Xmppframework,我写了两个函数: if let stream = xmppStream { if stream.isAuthenticated(){ println("Logged In") } else { println("something is wrong") } } func xmppStreamDidConnect(sender: XMPPStream) { println("xmppStre

我写了两个函数:

if let stream = xmppStream {
        if stream.isAuthenticated(){
            println("Logged In")
        } else {
            println("something is wrong")
        }
}


func xmppStreamDidConnect(sender: XMPPStream) {
    println("xmppStreamDidConnect")
    isOpen = true
    var error: NSError?
    if (xmppStream!.authenticateWithPassword(password.text, error: &error) ) {
        println("authentification successful")
        performSegueWithIdentifier("goToBuddyList", sender: nil)
    }
}
当我运行我的应用程序时,它会在终端上打印:

something is wrong
xmppStreamDidConnect
authentification successful
即使我输入了真实的凭证,它也会在开始时打印[出现问题],然后再打印[身份验证成功]。为什么会这样


我只想在[出现问题]的情况下提醒用户,而不是在[成功]的情况下提醒用户,但在成功的情况下也会提醒用户。

实现xmppstreamdauthenticate未验证XMPPStreamDelegate的方法

调用authenticateWithPassword后,客户端身份验证肯定会在上述两个函数(XMPPstreamDiaAuthenticate和didNotAuthenticate)中结束,直到流。isAuthenticated()将返回“0”