我只是第一次尝试使用 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")
}
}
}
}
最佳答案
确实忘记了 session.connect()
来启动连接
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")
}
}
关于ios - NMSSH 不与 SWIFT 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35271828/