V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
cxq
V2EX  ›  iDev

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

  •  
  •   cxq · 2015-08-25 11:17:46 +08:00 · 3457 次点击
    这是一个创建于 3174 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

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

    第 1 条附言  ·  2015-08-25 17:39:34 +08:00
    另外纯属好奇, 怎么能让自己的 Mac App 接受命令行参数呢?
    9 条回复    2015-08-27 20:35:40 +08:00
    matsuijurina
        1
    matsuijurina  
       2015-08-25 12:00:01 +08:00   ❤️ 1
    可以的, mac app 的发挥空间比 ios 的还是大很多。 用 NSTask , 参考这篇 http://www.raywenderlich.com/36537/nstask-tutorial
    cxq
        2
    cxq  
    OP
       2015-08-25 13:26:20 +08:00 via iPhone
    @matsuijurina 谢谢 非常有用
    djyde
        3
    djyde  
       2015-08-25 13:54:41 +08:00
    为啥不用 Git
    cxq
        4
    cxq  
    OP
       2015-08-25 17:33:54 +08:00
    @djyde 跟版本管理没关系, 我是写的一个根据,接口文档生成 php 脚本,然后自动传到 vps 的 mac app 。 偶尔用一下方便团队人生成假数据的。
    honeycomb
        5
    honeycomb  
       2015-08-25 17:40:21 +08:00
    @matsuijurina AppStore 的沙盘软件也行吗?
    SwiftSandbox
        6
    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
        7
    cxq  
    OP
       2015-08-26 06:16:26 +08:00
    @SwiftSandbox 谢谢 你是在哪里找到的资料呢?
    SwiftSandbox
        8
    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
        9
    cxq  
    OP
       2015-08-27 20:35:40 +08:00
    @SwiftSandbox Yes, thanks.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2034 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 01:12 · PVG 09:12 · LAX 18:12 · JFK 21:12
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.