Objective-C 调用sell脚本含参数
来源:互联网 发布:拓普康数据转换软件 编辑:程序博客网 时间:2024/06/08 19:29
直接可以执行shell脚本,并检查脚本的运行情况
@interface ViewController()
{ NSTimer * timer; NSTask *task;}
-(void)shellScript:(NSString *)shellName{ NSArray* paths = NSSearchPathForDirectoriesInDomains(NSApplicationDirectory, NSSystemDomainMask, YES); NSString* thepath = [paths lastObject]; NSString * strr = [NSString stringWithFormat:@"%@/%@",thepath,shellName]; task = [[NSTask alloc] init]; [task setLaunchPath:@"/bin/sh"]; [task setArguments:[NSArray arrayWithObjects:strr,parameter1,parameter2,nil]];//sh test.sh parameter1 parameter2 [task launch]; timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateTime) userInfo:nil repeats:YES];}-(void)updateTime{ if (!task.running) { [timer invalidate]; }}
1 0
- Objective-C 调用sell脚本含参数
- Objective-C调用shell脚本
- objective-c 多参数方法的定义与调用
- Objective-c与js相互调用及传参数注意
- objective-c 多参数方法的定义与调用
- Objective-C与js相互调用及传参数注意
- Objective C @property 参数
- Objective-C - @property参数
- Swift调用Objective-C
- Objective-C调用Swift
- Swift调用Objective-C
- Objective-C调用Swift
- Objective-c调用Swift
- Objective C 链式调用
- C# 调用C/C++ Dll(参数含char*指针,返回char*指针)
- Objective-C 运行AppleScript脚本
- 学习Mac开发第六弹 学习objective-c 调用shell 脚本
- Objective-C 函数参数理解
- 自制的Docker镜像
- Keepalived原理与实战精讲
- java 计算String的ASCII码
- 使用Action、Data属性启动系统Activity
- LeetCode - 74. Search a 2D Matrix
- Objective-C 调用sell脚本含参数
- 《剑指offer》:[67]机器人的运动范围
- 去掉导航栏下面的一条黑线
- Javascript定义类(class)的三种方法
- 飞机特效粒子效果
- swift-error-this class is not key value coding-compliant for the key sure.'
- printf能输出string型的变量吗?
- Python gevent模块
- 你所不知的 CSS ::before 和 ::after 伪元素用法