首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从其他应用程序/命令行/ Apple脚本运行的Xcode

从其他应用程序/命令行/ Apple脚本运行的Xcode
EN

Stack Overflow用户
提问于 2017-09-01 13:01:58
回答 1查看 388关注 0票数 0

是否可以在后台使用Xcode,但可以通过脚本编译和运行当前项目?

我主要使用AppCode进行开发,但希望通过热键从Xcode运行。AppCode没有正确地显示编译进度条(第二个屏幕上的Xcode),而且AppCode的调试能力不如Xcode的高级,否则AppCode会更快更好。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-09-01 14:33:23

可以使用AppleScript,下面是一个示例脚本(在和Xcode版本8.3.3上进行测试):

代码语言:javascript
复制
tell application "Xcode"
    tell active workspace document to if exists then
        repeat until (loaded) -- Whether the workspace document has finished loading after being opened
            delay 1
        end repeat
        run -- Invoke the "run" scheme action
    end if
end tell

要在特定设备上运行:我没有需要测试的设备,但我使用模拟器,尝试以下脚本:

代码语言:javascript
复制
tell application "Xcode"
    tell active workspace document to if exists then
        repeat until (loaded) -- Whether the workspace document has finished loading after being opened
            delay 1
        end repeat
        --**** run on a specific device ****
        set active run destination to run destination "iPad Pro (12.9 inch)" -- *** change it to the name of your device  ***

        set schAction to run -- Invoke the "run" scheme action
        repeat while (get status of schAction) is in {not yet started, running} -- exit the loop when the status is (‌cancelled, failed, ‌error occurred or ‌succeeded), so I press the stop button in Xcode, or I delete the application in the simulator or I quit the simulator.
            delay 3
        end repeat

        --**** run on another specific device ****
        set active run destination to run destination "iPhone 7" -- *** change it to the name of your device  ***
        run
    end if
end tell
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46000859

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档