我想从命令行启动一个应用程序,并立即使用XCode 4中的图形调试器连接它,而无需点击Xcode菜单Product->Attach To Progress。是否可以使用bash或Apple脚本自动化这个过程?
我想从命令行启动一个应用程序,并立即使用XCode 4中的图形调试器连接它,而无需点击Xcode菜单Product->Attach To Progress。是否可以使用bash或Apple脚本自动化这个过程?
这似乎在Xcode-Beta版本6.2(6C121)中有效。对于Xcode,只需将“Xcode-Beta”更改为Xcode。此外,您需要将进程名称“Staging”更改为要附加的进程。
tell application "Xcode-Beta"
activate
end tell
tell application "System Events"
tell application process "Xcode"
click (menu item "By Process Identifier (PID) or Name…" of menu 1 of menu item "Attach to Process" of menu 1 of menu bar item "Debug" of menu bar 1)
end tell
tell application process "Xcode"
set value of text field 1 of sheet 1 of window 1 to "Staging"
end tell
tell application process "Xcode"
click button "Attach" of sheet 1 of window 1
end tell
end tell
适用于Xcode 12
tell application "Xcode"
activate
end tell
tell application "System Events"
tell application process "Xcode"
click (menu item "Attach to Process by PID or Name…" of menu 1 of menu bar item "Debug" of menu bar 1)
end tell
tell application process "Xcode"
set value of text field 1 of sheet 1 of window 1 to "Your App/Process Name"
end tell
tell application process "Xcode"
click button "Attach" of sheet 1 of window 1
end tell
end tell
tell application "our App/Process Name"
activate
end tell