Using xcodebuild with Swift in a loop will raise a "Cannot determine the current working directory" error

(Tobias Scholze) #1

Hi folks,
great to see such an active and helpful community! I don't know if my issue
fits the requirements for this mailling list but I hope that you may help

I'm building a small script to run "xcodebuild" with different settings.
That's why I'm using a loop to iterate my device settings.

Everything works fine as long as I have only one item in my list. If I have
two, the first build runs successful but the second, third, etc will fail
with the error "Cannot determine the current working directory".

That is very confusing. Thanks for your help.

A short snippet of the bash script:

    for DEVICE in ${DEVICE_LIST[*]}
        # DEVICE => 'iPhone 5' or 'iPhone 6'
        # SCHEME_NAME => 'myXcodeSchemeName'
        xcodebuild test -scheme $SCHEME_NAME -destination "platform=iOS
Simulator,name=${IDENTIFIER},OS=9.1" -resultBundlePath $OUTPUT_WORKING_DIR

I already ask this question in stackoverflow and in the offical Apple
developer forum. There were no answers until now.

Have a wonderful week,

Kind regards, Tobi