Problema de conexão XMPP no IOS usando Swift
Estou tentando usar a estrutura XMPP (https://github.com/robbiehanson/XMPPFramework) usando swift. Eu sou novo em veloz
class ViewController: UIViewController {
var password: NSString?
var isOpen: Bool = false
var xstream: XMPPStream?
var loginServer: String = ""
override func viewDidLoad() {
super.viewDidLoad()
println(connect())
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func connect() ->Bool{
var xstream = XMPPStream()
var error: NSError?
xstream.addDelegate(self, delegateQueue: dispatch_get_main_queue())
xstream.myJID = XMPPJID.jidWithString("test@localhost")
xstream.hostName="127.0.0.1"
xstream.hostPort=5222
var password = "testing"
if !xstream.connectWithTimeout(XMPPStreamTimeoutNone, error: &error) {
println(error)
}
println(xstream.isConnecting()) // This prints true
return xstream.isConnected();// This prints false.
}
}
O nome de usuário e a senha e os detalhes do servidor estão corretos porque eu uso o adium para conectar ao servidor e funciona bem.