NMSSH不与SWIFT连接

时间:2016-02-08 14:18:22

标签: ios swift ssh nmssh

我只是第一次尝试使用NMSSH,但它根本就没有为我连接

import UIKit
import NMSSH

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.

        let session = NMSSHSession(host: "11.111.11.11", andUsername: "vnc")
        if session.connected == true{
            session.authenticateByPassword("1234")
            if session.authorized == true {
                print("works")
            }
        }

    }


}

1 个答案:

答案 0 :(得分:4)

忘了let session = NMSSHSession(host: "11.111.11.11", andUsername: "inc") session.connect() if session.connected == true{ session.authenticateByPassword("1234") if session.authorized == true { print("works") } } 开始连接

"/></script>