MAC App 开发, 能不能运行 mac 本地的脚本?

2015-08-25 11:17:46 +08:00
 cxq

想写一个 mac app , 把 php 脚本上传到我的 vps.

能不能在 mac app 中调用 shell 脚本, 然用 sshpass scp 实现?

3551 次点击
所在节点    iDev
9 条回复
matsuijurina
2015-08-25 12:00:01 +08:00
可以的, mac app 的发挥空间比 ios 的还是大很多。 用 NSTask , 参考这篇 http://www.raywenderlich.com/36537/nstask-tutorial
cxq
2015-08-25 13:26:20 +08:00
@matsuijurina 谢谢 非常有用
djyde
2015-08-25 13:54:41 +08:00
为啥不用 Git
cxq
2015-08-25 17:33:54 +08:00
@djyde 跟版本管理没关系, 我是写的一个根据,接口文档生成 php 脚本,然后自动传到 vps 的 mac app 。 偶尔用一下方便团队人生成假数据的。
honeycomb
2015-08-25 17:40:21 +08:00
@matsuijurina AppStore 的沙盘软件也行吗?
SwiftSandbox
2015-08-25 22:23:15 +08:00
To read Mac app command line arguments:

NSUserDefaults *standardDefaults = [NSUserDefaults standardUserDefaults];
NSString *strArg = [standardDefaults stringForKey:@"str"];
NSInteger intArg = [standardDefaults integerForKey:@"x"];

// Examples: here is command line with app and two parameters
yourApp -str "StringArg" -x 99
cxq
2015-08-26 06:16:26 +08:00
@SwiftSandbox 谢谢 你是在哪里找到的资料呢?
SwiftSandbox
2015-08-26 08:15:09 +08:00
Enter the code inside a Mac app and you can read the command line parameters. Is that what you are looking for help with?
cxq
2015-08-27 20:35:40 +08:00
@SwiftSandbox Yes, thanks.

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/215789

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX