Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anyone had success with Copy Files build phases in Xcode 4 templates

I've been trying to add a Copy Files build phase to a project template for Xcode 4 but I cannot figure out how to add files to copy.

Here's what I've added to my target. Changes to DstPath, DstSubfolderSpec and RunOnlyForDeploymentPostprocessing are all reflected in projects created from the template. But no files. I have tried adding an array using keys named Files, Definitions, Nodes, nothing has any affect.

Any thoughts or ideas would be greatly appreciated!

        <key>BuildPhases</key>
        <array>
            <dict>
                <key>Class</key>
                <string>CopyFiles</string>
                <key>DstPath</key>
                <string></string>
                <key>DstSubfolderSpec</key>
                <string>10</string>
                <key>RunOnlyForDeploymentPostprocessing</key>
                <string>NO</string>
            </dict>
        </array>
like image 216
David Rogers Avatar asked Apr 16 '11 04:04

David Rogers


2 Answers

I found a little gem hidden in some weird python script that gave a "better" (as opposed to nothing) explanation of the mysterious DstSubfolderSpec

# dstSubfolderSpec property value used in a PBXCopyFilesBuildPhase object.
'BUILT_PRODUCTS_DIR': 16,  # Products Directory
 : 1,                      # Wrapper
 : 6,                      # Executables: 6
 : 7,                      # Resources
 : 15,                     # Java Resources
 : 10,                     # Frameworks
 : 11,                     # Shared Frameworks
 : 12,                     # Shared Support
 : 13,                     # PlugIns

There's actually quite a bit of interesting info in the script, (apparently it's part of pythonwebkit, or something).. but regardless, I posted a gist of it here if you want to try and glean any other useful tidbits.

like image 123
Alex Gray Avatar answered Nov 14 '22 23:11

Alex Gray


So far I have this working:

<dict>
    <key>Class</key>
    <string>CopyFiles</string>
    <key>DstPath</key>
    <string>www</string>
    <key>DstSubfolderSpec</key>
    <string>7</string>

This creates a CopyFiles build phase that copies files to the folder "www" inside of Resources. (This would result in those files living under /www in the app bundle.) However, I haven't yet been able to specify which files get copied. This is similar to this question

like image 1
thrusty Avatar answered Nov 14 '22 21:11

thrusty