Xcode 4 Archive 构建未在预编译标头中找到导入
我有一个项目无法在 Xcode 4 中正确存档构建。在我看来,“Build For Archiving”和“Archive”命令的构建方式不同,我无法确定原因!
详细信息:
- 工作区包含两个项目:一个应用程序和一个静态库;这些项目是同等排列的。
- “构建”和“运行”都可以正常工作;应用程序在 iOS 模拟器和设备上执行。
- “为运行而构建”、“为测试而构建”、“为分析而构建”和“为存档而构建”也都可以正常工作。
- 针对运行而构建是调试,针对分析而构建是发布,因此两种配置都已经过测试。
- “存档”失败!
失败1(库):
当我尝试在库上执行“存档”命令时,自定义资源脚本失败。该脚本正在从资源目录 ($RESOURCES_DIR) 中读取
对于发布版本,这映射到:
...DerivedData/App-uniquecrap/Build/Products/Release-iphoneos/Resources/LibraryName
对于存档,这映射到:
...DerivedData/App-uniquecrap/ArchiveIntermediates/Build Frameworks/BuildProductsPath/Release-iphoneos/Resources/LibraryName
除了 ArchiveIntermediates
树中缺少 Resources
之外!
更新:问题的第一部分是由脚本文件中的引用不当引起的。 Xcode4 的路径现在包含一个带有嵌入空格的文件夹(想象一下!),并且不正确的引用路径不会像我们希望的那样工作。修复后,我仍然遇到一个问题,即收集资源构建阶段复制的资源文件没有到达正确的位置;脚本期望它们位于 $(RESOURCE_DIR) 中,但我似乎无法在收集资源中找到正确的设置将它们发送到那里。建议?
失败2(应用程序):
当我设法解决第一次失败的问题时(通常是通过复制文件并绕过脚本),我在构建应用程序时遇到了另一个错误。 “Archive”抱怨在构建预编译头时找不到导入的文件。
这里也没什么不寻常的。标头以典型方式导入到 pch 文件中:
#import <LibraryName/Library.h>
和以前一样,“构建”、“构建存档”等成功,没有问题。 “存档”失败。包含路径设置正确并且“存档”忽略它们;或者包含路径设置不正确,并且 Xcode 会在其他版本中自动修复它们。 (无论哪种方式,我都非常沮丧)。
我怎样才能(A)使存档构建工作;或者(B)弄清楚发生了什么,以便我可以完成(A)?
谢谢。
I have a project which won't Archive-build correctly in Xcode 4. It appears to me that the "Build For Archiving" and "Archive" commands build differently, and I cannot determine any reason why!
Details:
- The workspace contains two projects: an app and a static library; the projects are arranged as peers.
- "Build" and "Run" both work correctly; app executes in iOS simulator and on device.
- "Build for Running", "Build for Testing", "Build for Profiling", and "Build for Archiving" all work correctly also.
- Build for Running is debug, Build for Profiling is release, so both configuration have been tested.
- "Archive" fails!
Failure 1 (Library):
When I try to execute the "Archive" command on the library, a custom resource script fails. The script is reading from the resources directory ($RESOURCES_DIR)
For release builds, this maps to:
...DerivedData/App-uniquecrap/Build/Products/Release-iphoneos/Resources/LibraryName
For the archive, this maps to:
...DerivedData/App-uniquecrap/ArchiveIntermediates/Build Frameworks/BuildProductsPath/Release-iphoneos/Resources/LibraryName
Except Resources
is missing in the ArchiveIntermediates
tree!
UPDATE: The first part of the problem is caused by poor quoting in the script file. Xcode4's paths now include a folder with an embedded space (imagine that!) and improperly quotes paths don't work as well as we would like. That fixed, I still have the problem that the resource files copied by the Gather Resources build phase are not going to the correct location; the script expects them in $(RESOURCE_DIR), but I can't seem to find the correct setting in Gather Resources to send them there. Suggestions?
Failure 2 (App):
When I have managed to kludge my way part the first failure (typically by copying files and bypassing the script), I run into another error building the App. "Archive" complains that it can't find imported files when building the precompiled headers.
Nothing unusual here either; headers are imported in pch file in the typical manner:
#import <LibraryName/Library.h>
As before, "Build", "Build for Archiving", etcetera succeed without problem. "Archive" fails. Either the include paths are set up correctly and "Archive" is ignoring them; or the include paths are set up incorrectly and Xcode is auto-magically fixing them in the other builds. (Either way, I'm very frustrated).
How can I (A) make Archive builds work; or (B) figure out what is going on, so I can accomplish (A)?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论