Executing shell commands for iOS apps

734 Views Asked by At

How do I execute shell commands for iOS app in Xcode(it does not support NSTask.h as the app is sandboxed)?

1

There are 1 best solutions below

0
DarkDust On

You can't. There is no (public) shell available, and also no (public) high-level API to run external commands. This is a deliberate restriction of iOS.

You might be able to use low-level POSIX/Mach APIs like posix_spawn to start an executable that you bundle, though. But even if you manage to do that, it's likely that Apple will reject your App Store submission if you do that.