任何人都在 Xcode 4 模板中的复制文件构建阶段取得了成功

发布于 2024-11-02 02:00:07 字数 808 浏览 0 评论 0原文

我一直在尝试将复制文件构建阶段添加到 Xcode 4 的项目模板中,但我不知道如何添加要复制的文件。

这是我添加到目标中的内容。对 DstPath、DstSubfolderSpec 和 RunOnlyForDeploymentPostprocessing 的更改都反映在从模板创建的项目中。但没有文件。我尝试使用名为“文件”、“定义”、“节点”的键添加数组,但没有任何影响。

任何想法或想法将不胜感激!

        <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>

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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦一生花开无言 2024-11-09 02:00:07

我发现一个隐藏在一些奇怪的 python 脚本中的小宝石,它为神秘 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

实际上有很多有趣的地方脚本中的信息(显然它是 pythonwebkit 的一部分,或者其他东西).. 但是不管怎样,如果你想尝试收集任何其他有用的花絮,我在这里发布了它的要点

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.

柠檬色的秋千 2024-11-09 02:00:07

到目前为止,我已经完成了这项工作:

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

这将创建一个 CopyFiles 构建阶段,将文件复制到资源内的文件夹“www”。 (这将导致这些文件位于应用程序包中的 /www 下。)但是,我还无法指定复制哪些文件。这类似于 这个问题

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

赴月观长安 2024-11-09 02:00:07

我不知道答案,但这可能是一个解决方法。它在每次构建时运行一个脚本。

<key>Targets</key>
<array>
    <dict>
        <key>BuildPhases</key>
        <array>
            <dict>
                <key>Class</key>
                <string>ShellScript</string>
                <key>ShellPath</key>
                <string>/bin/sh</string>
                <key>ShellScript</key>
                <string>~/hello.sh</string>
            </dict>

在此处输入图像描述

请注意,脚本的路径是绝对路径。也许您可以使用 PathType Group 定义路径,以将其设置为相对于项目内的组(我没有尝试)。

DstPath 是要复制的文件的目标路径(我猜)。我不知道DstSubfolderSpec是什么,它只出现在命令行工具中,值为0。我猜你也不知道。

I don't know the answer but this may be a workaround. It runs a script with each build.

<key>Targets</key>
<array>
    <dict>
        <key>BuildPhases</key>
        <array>
            <dict>
                <key>Class</key>
                <string>ShellScript</string>
                <key>ShellPath</key>
                <string>/bin/sh</string>
                <key>ShellScript</key>
                <string>~/hello.sh</string>
            </dict>

enter image description here

Note that the path to the script is absolute. Maybe you can define a path with PathType Group to set it relative to a group inside the project (I didn't try).

DstPath is the destination path of the files to copy (I guess). I don't know what DstSubfolderSpec is, it only appears in the Command Line Tool with a value of 0. I guess you don't know it either.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文