I want to execute a Shell Command in my Swift Application. I read that i can't use NSTask, because there is no built in SSH in the iPhone. Now my question is how i can implement this without NSTask.
2 Answers
Any use of API that forks and spawns a new process is disallowed by the App Store rules, so if you want to do this for an app you plan to submit, the short answer is that you can't.
NSTask and the exec*(3) family of C library functions certainly exist on iOS, but they aren't public API.
If you need SSH functionality, you need to find a library that provides that functionality to pass App Store review.
3 Comments
mattionline
I dont want to submit the App to the App Store. I just want a App for me personally that starts and stops a Service that runs on my local Server.
Steve Madsen
Two options, then: 1. Use an SSH client library to make the connection. 2. Jailbreak your phone, install an SSH client (if one isn't installed for you), and use
NSTask or exec*(3).mattionline
can you recommand a ssh library? i'd like to avoid jailbreaking my phone