danielbeard danielbeard - 2 years ago 74
iOS Question

Copy dynamically created file into built app package

I have a file that I create in the

folder of my iOS project when run. I want to copy this file so that when I build my app it is embedded in the package.


  • When the app is built I create a file

  • I want this file to be copied to the app like a normal resource E.g.

Here is what I have tried:

I have created a
Build Phase
Run Script
with the following:

cp "${SRCROOT}/xyz.txt ${DSTROOT}/xyz.txt

The above doesn't copy the file to where I want it to go. I have looked at this list of build variables but I'm not sure which one will work for my purpose.

How can I copy the created
file to the main app bundle as a build phase?

Answer Source

I found the answer in this question: http://stackoverflow.com/a/7287596/1144632

I ended up using the following in my Run Script

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download