doudan4834 2014-09-15 15:48
浏览 45
已采纳

如何让iOS运行子流程?

I am writing an app for iOS that will start the php binary as a sub process.

The following code is used:

NSString * command = @"/bin/sh -c '";
command = [command stringByAppendingString:[BibleditPaths php]];
command = [command stringByAppendingString:@" -v' > /tmp/php.txt 2>&1"];
int output = system ([command UTF8String]);
NSString* msg = [@(output) stringValue];
NSLog(msg, @"");

The php binary can be started on a jailbroken iPad from the command line. This is the output:

PHP 5.4.31 (cli) (built: Aug 19 2014 11:06:21) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

When starting the php binary from the code above, iOS sends the SIGKILL signal. The php binary does not run or produce any output.

/bin/sh produces this output:

sh: line 1:  2806 Killed: 9               /bin/sh -c '/var/mobile/Applications/DFE552CC-ECBE-4A73-82CF-24870E5D9F62/Library/usr/local/bin/php -v' > /tmp/php.txt 2>&1
2014-09-15 17:33:41.676 PHPRunner[2804:60b] 35072

What can I do to get iOS to run this process successfully?

  • 写回答

1条回答 默认 最新

  • douyuepi6485 2014-09-17 06:00
    关注

    This question was posted on the Apple iOS development forum (https://devforums.apple.com/index.jspa).

    The response there was:

    "None of that is supported (or permitted by the application sandbox) on iOS."

    Subsequently the question was deleted from the forum.

    I am posting the answer here so the information is kept for the public.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘