[英]How to run an Xcode built app from the command line (bash)
Following on from my question How to run an xcode project from bash? 继我的问题如何从bash运行xcode项目?
I've found the built *.app in the build directory, but I'm trying to figure out how to get xcode to open it as it can't just be run as a Mac OS X program. 我在构建目录中找到了构建的* .app,但我正在试图弄清楚如何让xcode打开它,因为它不能仅仅作为Mac OS X程序运行。
Any ideas? 有任何想法吗?
thanks to chuan at this post: XCode Test Automation For IPhone 感谢ch在这篇文章: iPhone的XCode测试自动化
I'm stuck with the same problem trying to launch my debug output from building my xcode project. 我遇到了同样的问题,试图从构建我的xcode项目启动我的调试输出。 I just experimented with the following 我只是尝试以下
open ./prog.app&
seems to do the trick. 似乎可以做到这一点。
I've solved my problem using a bash file that uses rsync to sync working directories and then AppleScript which builds and runs the project. 我使用bash文件解决了我的问题,该文件使用rsync来同步工作目录,然后使用AppleScript来构建和运行项目。
sync.sh: sync.sh:
#!/bin/bash
# script for moving development files into xcode for building
developmentDirectory="/"
xcodeDirectory="/"
echo 'Synchronising...'
rsync -r $developmentDirectory $xcodeDirectory \
--exclude='.DS_Store' --exclude='.*' --exclude='utils/' --exclude='photos'
echo 'Synchronising Done at:'
echo $(date)
buildandrun: buildandrun:
set projectName to "projectName"
# AppleScript uses : for / in directory paths
set projectDir to "Users:username:Documents:" & projectName & ":" & projectName & ".xcodeproj"
tell application "Xcode"
open projectDir
tell project projectName
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
Then, finally, I'm using a shell script called run.sh aliased in my .bash_profile: 然后,最后,我在.bash_profile中使用名为run.sh的shell脚本:
run.sh: run.sh:
#!/bin/bash
bash utils/sync.sh
osascript utils/buildandrun
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.