Copying Files While Building a Product

    Steps
  1. In the project editor, select the target to which you want to add a Copy Files build phase.

  2. Click Build Phases at the top of the project editor.

  3. From the Add Build Phase menu in the lower-right corner, choose Add Copy Files.

  4. Use the Destination pop-up menu and the Subpath text field to specify where to copy the file or files.

  5. Click the Add (+) button to select a file to copy and click Add.

image: ../Art/CopyingFilesWhile BuildingaProduct.png

Copy files and resources of any type to specific locations as part of the build process using a Copy Files build phase.

For example, you can copy fonts to /Library/Fonts. Or, if you’re developing a plug-in, a Copy Files build phase can copy the generated plug-in to the appropriate location. You can have as many Copy Files build phases in a target as you need.

Together, the Destination pop-up menu and the Subpath field specify the location to which Xcode copies the files. The Destination pop-up menu lets you choose from a number of standard locations. Use the Subpath field to specify the path, relative to the location specified in the Destination pop-up menu, to the target directory.

Select the option "Copy only when installing" to specify that the build phase copies files only in install builds of the product.

The screenshot shows a Copy Files build phase that copies the SKTInfo.plist file to a folder titled Info in the Resources folder.