开发者

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?

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.

Any ideas?

thanks t开发者_StackOverflow中文版o chuan at this post: XCode Test Automation For IPhone


I'm stuck with the same problem trying to launch my debug output from building my xcode project. 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.

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:

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:

run.sh:

#!/bin/bash

bash utils/sync.sh
osascript utils/buildandrun
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜