Qt World Summit: Submit your Presentation

Shell command on iOS (system command)

  • Hello everyone,
    I'm actually trying to execute a shell command on ios using the "system" command in Qt.
    system("launchctl list > process.txt");
    That return me this error : shell-init: Operation not permitted.

    I also try to use QProcess but this doesn't work too.
    QProcess process;
    process.start("launchctl list > process.txt");
    That doesn't return me error message but that doesn't work too.
    I just have "program received signal 20, thrad:42d2a;qaddr"

    I don't know if my problem is because I try to execute shell command on iOS, or if my app isn't allowed to execute shell command.

    I know this command existe on iOS because I can excute it with a ssh connection.

    Thanks for your help.

  • Hi,

    As I know you can't execute any commands or shell-script on the iOS from you application on official devices. Because security policy doesn't allowing you to do this. Application can't work with any datas not from application folder. If you need something to be execute you can try to copy shell script into application folder and then execute it.

    Also I recommend you read Apple documentation about certificate and how it works on iOS platform. In general, when you build your app and install it to official devices your application must be subscribe using special certificate which you need to receive from Apple (Apple iOS Developer program). If your application will not be subscribe with this certificate other people can't install your application and your application not be approve in App Store.

    Other link:

    P.S. From your post I understand you are using jailbreak device, right? If so I recommend to you don't use it. Because on the official device it couldn't work.
    P.S.S. iOS and OS X application can't execute any third-part processes and script. Because certificate will block all third-part calls. But if you don't need to post you app to App Store you could skip Code sign of your app (I've use it only on OS X, on iOS you need special certificate).