简体   繁体   English

Applescript Xcode在iPhone设备上清理,构建和安装

[英]Applescript Xcode to clean, build and install on iPhone device

I'm trying to applescript XCode into building and launching on device. 我正在尝试将XCode用于构建和启动设备。 My script is as follows: 我的脚本如下:

tell application "Xcode"
    open "tmp:iphone:myproject:Project.xcodeproj"
    tell project "Project"
        clean
        build
        launch
    end tell
end tell

My project consists of two targets, MainTarget and a SideTarget, the SideTarget is added as a direct dependency of MainTarget. 我的项目由两个目标MainTarget和一个SideTarget组成,SideTarget被添加为MainTarget的直接依赖项。 I noticed that when my applescript runs on a pre-cleaned project (removing the build folder) only 65 files are compiled compared to when I press the "Build & Run" button in XCode 130 files are compiled. 我注意到,当我的AppleScript脚本在预先清理的项目上运行时(删除构建文件夹),与我按下XCode 130文件中的“Build&Run”按钮编译时相比,只编译了65个文件。

The "launch" command in the script seems to be ignored when running the applescript - it simply does not launch on the device. 运行applescript时,脚本中的“launch”命令似乎被忽略了 - 它根本就没有在设备上启动。 The status in the bottom bar when the script is complete is "Build succeeded". 脚本完成后底栏中的状态是“Build succeeded”。 What is the difference between "build" followed by "launch" compared to pressing the "Build & Run" button in the XCode top bar? 与按下XCode顶栏中的“Build&Run”按钮相比,“build”后跟“launch”有什么区别?

The project launches fine on device when building and running through XCode. 在通过XCode构建和运行时,该项目在设备上启动良好。

My main issue is that I can't get the applescript to launch on device. 我的主要问题是我无法在设备上启动AppleScript。 I do not know where things go wrong. 我不知道哪里出了问题。 Has anyone successfully scripted XCode to launch on device? 有没有人成功编写XCode脚本以在设备上启动?

I've had this same problem. 我有同样的问题。 launch just does not work. 发射只是不起作用。 You'll have to use debug instead. 您将不得不使用调试。 Also, debug blocks forever, so invoke it with timeout and catch the timeout error and ignore it. 此外,永远调试块,因此使用超时调用它并捕获超时错误并忽略它。

build and build and run are two separate commands within Xcode's GUI (v3.1.4 with build and go (run) and build and debug being the remainder). buildbuild and run是Xcode GUI中的两个独立命令(v3.1.4,包含build and go (run)build and debug是其余的)。 But the Dictionary for Xcode only shows build as being supported via Applescript. 但词典的Xcode只显示build为通过AppleScript的支撑。 I would say both of these commands are the same as they are in the GUI, and in a perfect AS world we would see build and run in the Dictionary to make it more clear. 我想说这些命令都与GUI中的命令相同,在完美的AS世界中,我们会看到build and run在Dictionary中build and run以使其更清晰。

My question is whether launch is really building the app or just launching the previously built executable. 我的问题是launch是真的构建应用程序还是只是启动以前构建的可执行文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM