Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从其他应用程序/命令行/苹果脚本运行Xcode_Xcode_Bash_Applescript_Appcode_App Code - Fatal编程技术网

从其他应用程序/命令行/苹果脚本运行Xcode

从其他应用程序/命令行/苹果脚本运行Xcode,xcode,bash,applescript,appcode,app-code,Xcode,Bash,Applescript,Appcode,App Code,是否可以在后台使用Xcode,但通过脚本编译和运行当前项目 我主要使用AppCode进行开发,但希望通过热键从Xcode运行。AppCode无法在第二个屏幕上正确显示编译进度条Xcode,而且AppCode的调试功能也不如Xcode的高级。否则,AppCode会更快更好。从AppleScript可以看出,下面是在Sierra和Xcode 8.3.3版上测试的示例脚本: 要在特定设备上运行:我没有要测试的设备,但我使用模拟器,请尝试以下脚本: tell application "Xcode"

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


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

从AppleScript可以看出,下面是在Sierra和Xcode 8.3.3版上测试的示例脚本:

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

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

哇,太快了,太棒了!非常感谢。您是否碰巧也知道在特定设备上运行?我正在制作一个实时多人游戏,我经常需要在两台设备上运行。在一台设备上运行会很酷,等到它完成后再在另一台设备上运行。
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