Xcode 4(和依赖项)的编译、构建或存档问题 [英] Compile, Build or Archive problems with Xcode 4 (and dependencies)

查看:25
本文介绍了Xcode 4(和依赖项)的编译、构建或存档问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题在过去几周已经发展到涵盖更一般的问题 (以及从旧的 s).

This question has evolved over the past several weeks to cover more general issues with xcode4 (and upgrading projects form older xcodes).

然而,许多问题可以通过遵循相同的指令集来解决.

However many of the issues can be solved by following the same set of instructions.

如果您有以下任何问题,请尝试已接受答案中的方法:

If you have any of the following issues, try the methods in the accepted answer:

  • Xcode 4 无法存档应用
  • Xcode 4 创建了一个无法使用的存档
  • Xcode 4 不会创建 .ipa
  • Xcode 4 由于预处理器错误而无法编译
  • Xcode 4 找不到标题
  • Xcode 4 的代码不能正常工作
  • 项目依赖项无法编译
  • 添加依赖会导致上述任何问题

标题:未找到词法或预处理器问题文件"在 Xcode 4 中

我在 Xcode 4 中有一个项目,它可以很好地构建并在设备和模拟器上运行,但是在查找与静态库关联的头文件时尝试存档时出错:

I have a project in Xcode 4 that will build fine and run on the device and simulator but when trying to Archive it errors when looking for headers files associated with a static library:

In file included from /Volumes/Development/Path/LBProject/LBProject/LBProject-Prefix.pch:15:
In file included from /Volumes/Development/Path/LBProject/LBFDefines.h:23:
In file included from /Volumes/Development/Path/LBProject/Classes/LBProjectAppDelegate.h:11:
In file included from /Volumes/Development/Path/LBProject/LBProject/../FKNDirectory/FKNDirectoryManager.h:10:
/Volumes/Development/Path/LBProject/LBProject/../FKNDirectory/FKNDataModel.h:11:9: fatal error: 'Merchant.h' file not found [1]
 #import "Merchant.h"
         ^
1 error generated. 

Xcode 给出错误

lexical or preprocessor issue file not found 

很多谷歌搜索表明很多人都有这个问题,但没有解决方案.任何人都得到了修复甚至线索.

Much Googling has show many people are having this issue but no solution. Anyone got a fix or even a clue.

更新:user header 搜索路径在所有配置中都设置为 ${BUILT_PRODUCTS_DIR}.除了归档时,它使用任何配置都可以很好地构建.

Update: The user header search paths are set to ${BUILT_PRODUCTS_DIR} in all configurations. It builds fine using any configuration except when archiving.

更新 2: Merchant.h 是一个自动生成的核心数据类,因此在 .xcdatamodeld 包内,但是标题构建库时全部复制到public headers目录中.

Update 2: Merchant.h is a Core Data class that is auto-generated and therefore inside .xcdatamodeld package, however the headers are all copied to the public headers directory when the library is built.

推荐答案

注意:以下步骤将解决 90% 的 Xcode 存档问题但是,从评论中建议您尝试 退出 Xcode第一的.这可能会为您节省数小时的设置调整时间.

NB: The steps below will solve 90% of your Xcode archive issues however, from the comments it is suggested you try quitting Xcode first. This may save you hours of setting tweaking.

  1. 检查用户标头路径"是否正确(在项目和依赖项中的空格路径中添加")
  2. 将始终搜索用户路径"设置为是"
  3. 在您的项目中创建一个组调用索引标题"并将标题拖到该组中,不要在出现提示时添加到任何目标.这包括 .xcdatamodeld 中的任何标题,您需要右键单击并查看包内容以找到它们.
  4. 对于所有依赖项,将跳过安装"构建设置设置为是"
  5. 将构建阶段中的任何公共"标题移动到项目"
  6. 将目标上的构建设置安装目录"设置为$(LOCAL_APPS_DIR)
  7. 将目标构建设置扫描所有源文件以查找包含"更改为是".(链接)
  8. 使用较新版本的 Xcode (> 4.2),您可能希望 阅读与工作区相关的问题.
  9. 手动从所有引用的项目中删除 project.xcworkspace 文件
  1. Check the "user header paths" are correct (Add "" to paths for spaces, both in your project and dependencies)
  2. Set "Always search user paths" to YES
  3. Create a group call "Indexing headers" in your project and drag the headers to this group, DO NOT add to any targets when prompted. This includes any headers inside your .xcdatamodeld, you'll need to right-click and view package contents to find them.
  4. For all dependencies set "Skip Install" build setting to "Yes"
  5. Moving any "Public" headers in Build Phases to "Project"
  6. Set the Build Setting "Installation Directory" on your Target to $(LOCAL_APPS_DIR)
  7. Change the target build setting "scan all source files for includes" to YES. (link)
  8. With newer versions of Xcode (> 4.2) you might want to read this question related to workspaces.
  9. Manually delete the project.xcworkspace files form all referenced projects

这篇关于Xcode 4(和依赖项)的编译、构建或存档问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆