2

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")
            }
        }

    }


}
Fabian Boulegue
  • 6,476
  • 14
  • 47
  • 72
  • I realize you've already figured out the answer. But this is a pretty vague question. "it simply does not connect" isn't very informative. You ought to describe exactly what happens when you run the code, including any error messages or exceptions that you get. – Kenster Feb 08 '16 at 15:46

1 Answers1

6

did forget the session.connect() to start the connection

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")
            }
        }
Fabian Boulegue
  • 6,476
  • 14
  • 47
  • 72
  • Added bridging Header file, followed instructions but having this error "Use of unresolved identifier 'NMSSHSession" at the let session = NMSSHSession(host: "11.111.11.11", andUsername: "inc"). Any idea why would happening ? – djay Nov 30 '17 at 12:24