0

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

  • I'd usually mark this as a duplicate of [iOS : Shell script from an iOS App](https://stackoverflow.com/questions/15645294/ios-shell-script-from-an-ios-app), but that question is almost 10 years old. – DarkDust Jul 01 '22 at 06:37
  • Yes ,I was hoping for an alternative but looks like it isn't possible – Ayushi Paul Jul 05 '22 at 05:24

1 Answers1

0

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.

DarkDust
  • 90,870
  • 19
  • 190
  • 224