4

I am working on a super simple little app that I distribute as a ZIP archive. The archive contains the app itself, a readme, and a few scripts. I wanted to automate this process, so I added the scripts to my project and auto-copied them into the build folder with a copy files build phase.

Now, I needed to actually automate the archiving, so I edited the build scheme's post-build actions to include a Run Script action, which included the following:

cd $BUILT_PRODUCTS_DIR
rm -f Kachunk.zip
zip Kachunk Kachunk.app readme.txt chunk.sh dechunk.sh

Now, this works great, but there's a fatal flaw. The app itself is not added properly. For some reason, when Xcode runs the script, the .app file is not fully built yet, so I end up with an app bundle with no contents whatsoever.

Is there something I'm doing wrong? Is there a workaround to this?

1 Answer 1

6

Nevermind, I got it. The problem was that .app files are really bundles, which are basically directories. So, it was copying the folder, but not its contents. This was easily fixed by adding the -r option on the zip command:

cd $BUILT_PRODUCTS_DIR
rm -f Kachunk.zip
zip -r Kachunk Kachunk.app readme.txt chunk.sh dechunk.sh

And then it works! This seems to be a problem when copying/zipping .app "files" in general.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.