在 xcode 中创建框架时保留目录结构
我正在尝试在 Xcode 中创建一个框架并已成功完成此操作,但事实证明,Xcode 在复制 中的标头时会展平目录结构复制标头构建阶段。我尝试将文件添加为文件夹引用而不是组,但它甚至不会将头文件识别为头文件!
那么,如何告诉 Xcode 在将头文件复制到我的 .framework-bundle 时保留目录结构?
I'm trying to create a framework in Xcode and have successfully done so, but as it turns out, Xcode flattens the directory structure of when copying headers in the Copy Headers build phase. I've tried adding the files as Folder References instead of the groups, but then it won't even recognize the header-files as header files!
So, how can I tell Xcode to keep the directory structure when copying the header files to my .framework-bundle?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
在构建阶段 UI 中使用复制文件而不是复制标头。
为每个所需的输出文件夹创建单独的复制文件(编辑器 -> 添加构建阶段)。
Use Copy Files instead of Copy Headers in the Build Phases UI.
Create a separate Copy Files (Editor -> Add Build Phase) for each output folder needed.
如果您无法使用文件夹引用,因为文件夹也包含您不想复制的非头文件,请改为添加运行脚本构建阶段:
这会将所有
.h
文件从您cd
的路径复制到YourFramework.framework/Versions/A/Headers
中,就像标记它们一样正如公众所愿。If you cannot use a folder reference because the folders contain non-header-files, too, which you don't want to copy, add a Run Script build phase instead:
That will copy all
.h
files from the path youcd
'd to intoYourFramework.framework/Versions/A/Headers
just like marking them as public would.看来这目前不是 xcode 的内置功能,因此您必须恢复到脚本以递归方式复制文件(大概只选择头文件): 在 XCode 的复制标头构建阶段将角色更改为公共时,如何保留子组?
以下是有关如何实现这一目标的讨论: http://www.cocoabuilder.com/archive/xcode/259185-copy-headers-that-preserves-subdirectory-struct.html
It seems that this is not currently a built in feature of xcode, so you must revert to scripts to copy files recursively (presumably selecting only header files): How can I preserve subgroups when changing role to public in Copy Headers build phase in XCode?
Here's a discussion about how to accomplish just that: http://www.cocoabuilder.com/archive/xcode/259185-copy-headers-that-preserves-subdirectory-structure.html
添加源文件夹作为对文件夹的引用(“添加文件...”对话框中的单选按钮)。然后将这些文件夹从“导航器”选项卡拖放到“构建阶段->复制文件”。
此后,标头将位于下一个版本的文件夹中。
Add source folder as reference to folder (radio button in the "Add files..." dialog). Then drag'n'drop those folders from Navigator tab to "Build Phases->Copy Files".
After this headers will be located in folders on next build.
来自这个问题接受的答案:
From this question's accepted answer: