在Sandbox中调用系统工具的问题
来源:互联网 发布:海思科技人工智能 编辑:程序博客网 时间:2024/05/21 10:02
在sandbox中要调用system的工具,用system函数,NSTask方式有的成功,有的不成功。
成功的例子有:
/usr/sbin/screencapture
/usr/bin/stat
不成功的例子有:
/usr/bin/qlmanage
/usr/bin/shasum
/usr/bin/hexdump
/sbin/ping
在网上找到一下答案
Sandbox and running /usr/bin/purge using system()
in an app that is on the Mac App Store, I was doing the following:
system("/usr/bin/nice -n 20 /usr/bin/purge &> /dev/null &");
This worked fine, but now I'm trying to submit a new version, and they're forcing me to enable the Sandbox. However, with the sandbox, that call fails, giving messages like this in the Console:
7/20/13 12:58:59.000 AM kernel[0]: Sandbox: sh(28537) deny file-read-data /dev/ttys0007/20/13 12:58:59.968 AM purge[28538]: bootstrap_look_up(): Permission denied7/20/13 12:59:00.000 AM kernel[0]: Sandbox: purge(28538) deny mach-lookup com.apple.appleprofilepolicyd7/20/13 12:59:00.521 AM purge[28538]: <CPDevice.m:3813> Unable to create new counter client.7/20/13 12:59:00.523 AM purge[28538]: <CPOSX.m:1188> Unable to get user client so as to poke the kernel.7/20/13 12:59:00.000 AM kernel[0]: Sandbox: purge(28538) deny iokit-open ApplePerformanceCounterManagerUserClient7/20/13 12:59:00.000 AM kernel[0]: Sandbox: purge(28538) deny iokit-open AppleProfileUtilitiesUserClient7/20/13 12:59:00.000 AM kernel[0]: AppleProfileUtilitiesUserClient: bad busy count (0,-1)7/20/13 12:59:00.000 AM kernel[0]: Backtrace 0xffffff802d22d4d2 0xffffff802d231fc9 0xffffff802ceb3137 0 0 0 0
Is there any way to work around this?
1 Answer
The official word on NSTask and Sandboxing is 'some executables may work.' For me this translates to 'don't count on it'. There are a ton of questions in the currently down Apple Dev Forums about this and purge
definitely seems to be one that is blacklisted.
- 在Sandbox中调用系统工具的问题
- Mac App Sandbox的问题.
- h5中调用alert,间接调用了系统的AlertDialog,在华为手机上显示不出内容的问题
- 如何在Linux系统中添加新的系统调用
- 在ETL工具Spoon中调用WebService的方法
- 在Sandbox(沙盒)中使用PeoplePicker
- Android APK中 调用系统工具
- Android 调用系统相机拍照并且显示在相册中,以及中间可能会遇到的一些问题的解决
- 在sandbox下对Mac app 验证receipt时遇到的问题
- 如何在Linux中添加新的系统调用
- excel在系统中集成调用的方法,C#
- 怎么在Linux中添加新的系统调用
- 在 Delphi 中调用系统的手形鼠标指针
- 怎么在Linux中添加新的系统调用
- 如何在Linux中添加新的系统调用
- 在业务系统中调用Jbpm的过程
- 如何在Activity中调用系统的返回功能
- 在Android系统中Service的远程调用
- vc中如何使用静态库的资源
- jquery 删除当前行,只需传递this
- 选择排序C语言实现
- 中药将不可避免走向没落
- [LeetCode]-Letter Combinations of a Phone Number 电话键盘的字符串组合
- 在Sandbox中调用系统工具的问题
- Android 4.4 apk安装到桌面生成icon过程
- 【图算法之二分图】HDU 1068---Girls and Boys
- onInterceptTouchEvent和onTouchEvent调用时序
- 用 DBMS_SCHEDULER 代替 DBMS_JOB
- C++基础之内联函数
- 电容参数:X5R,X7R,Y5V,COG 详解
- 使用HAProxy、PHP、Redis和MySQL支撑每天上亿请求的架构细节
- oracle学习之体系结构2