13

以下是我想要的步骤:

  1. 启动 xcode
  2. 打开特定的 xcodeproj 文件
  3. 构建和调试它
  4. 退出 xcode

以下是我第一次尝试编写 AppleScript:

tell application "Xcode"
    tell project "iphone_manual_client"
        debug
    end tell
    close project "iphone_manual_client"
end tell

这仅在 xcode 打开此项目时有效。我希望仅在必要时才打开该项目。

那里的任何 AppleScript 大师都可以为我指明正确的方向吗?谢谢。

-川-

4

4 回答 4

13

我想我设法解决了。以下是 AppleScript:

tell application "Xcode"
    open "Users:chuan:Desktop:iphone_manual_client:iphone_manual_client.xcodeproj"
    tell project "iphone_manual_client"
            clean
            build
            (* for some reasons, debug will hang even the debug process has completed. 
               The try block is created to suppress the AppleEvent timeout error 
             *)
            try
                debug
            end try
    end tell
    quit
end tell

路径的格式必须是“:”而不是“/”。现在唯一的问题是,在调试控制台完成工作后,AppleScript 似乎“挂起”,就好像在等待某些事情发生一样。我需要对 AppleScript 做更多的研究才能知道脚本有什么问题。

于 2009-06-17T14:44:18.120 回答
4

我不确定 AppleScript 但您可以从命令行编译它,而无需打开 xcode ide,如下所示:

xcodebuild -configuration Debug -target WhatATool -project WhatATool.xcodeproj

其中配置是显而易见的选项,target 是 xcode 的 Target 列表中的名称和最后的项目名称。

于 2009-06-17T13:43:22.347 回答
2

有一个名为xcodebuild(man page here)的命令行实用程序,它可能更适合您想要完成的任务。

于 2009-06-17T13:42:31.303 回答
2

由于调试可能会花费任意时间,因此您可能需要在调试消息周围设置“超时秒数”/“结束超时”块。

于 2009-06-17T17:22:52.463 回答