I am trying to get a JSON file from my server to my iPhone. I am using NMSSH for my FTP connection and the connection works.
But I can't retrieve any data from my server. It doesn't matter what path I am using ~/
or /
or /someFolder/
or someFolder
. Every time, I am getting the error:
NMSSH_Test[] NMSSH: Could not open file at path /testDirectory (Error 0: )
Here my code:
class Data {
init() {
let session = NMSSHSession.init(host: "someIp", andUsername: "user")
session.connect()
if session.isConnected{
session.authenticate(byPassword: "password")
if session.isAuthorized {
let sftpsession = NMSFTP(session : session)
sftpsession.contents(atPath: "/testDirectory")
// if (sftpsession.contentsOfDirectory(atPath: "~/") != nil) {
// print("Found Data!")
// }
}
}
}
}