NMSSH 无法与 SWIFT 连接 [英] NMSSH does not connect with SWIFT
本文介绍了NMSSH 无法与 SWIFT 连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是第一次尝试使用 NMSSH,但它根本无法连接我
I just tried to use NMSSH for the first time but it simply does not connect for me
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")
}
}
这篇关于NMSSH 无法与 SWIFT 连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文