xcodebuild 在嵌入式项目中找不到标题 [英] xcodebuild cannot find header in embedded projects

查看:28
本文介绍了xcodebuild 在嵌入式项目中找不到标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目嵌入了另一个项目,xcode GUI 构建成功,但在命令行中 xcodebuild 失败了.

I have a project embed another project, and the xcode GUI build was successful, but in command line xcodebuild failed as such.

   fatal error: 'OHAttributedLabel/OHAttributedLabel.h' file not found
   #import <OHAttributedLabel/OHAttributedLabel.h>
           ^
   1 error generated.

但我在项目 HEADER SEARCH PATH(h 所在的位置)中有这个

but I had this in the project HEADER SEARCH PATH (where the h is located)

   ${PROJECT_DIR}/MyProject/Vendor/OHAttributedLabel/Source

问题是header位于OHAttributedLabel/Source"文件夹下,而import语句是在OHAttributedLabel文件夹下寻找header,我不想碰嵌入的项目目录结构,在这怎么办案件?

the problem is the header is located in the "OHAttributedLabel/Source" folder, while the import statement is looking for header under OHAttributedLabel folder, I don't want to touch the embedded project directory structure, what can I do in this case?

推荐答案

最好的方法是修改嵌入式项目发布头文件:

The best way is to modify the embedded project to publish the header files:

  1. 在 xCode 中选择嵌入的项目
  2. 选择适用的目标.
  3. 点击构建阶段
  4. 展开复制标题"部分并添加 OHAttributedLabel.h 文件.
  5. 选择您的主要项目
  6. 选择适用的目标.
  7. 点击构建阶段.
  8. 点击目标依赖项.
  9. 确保将嵌入的项目添加为依赖项.
  10. 尝试运行应用

如果上述方法不起作用,请仔细检查构建阶段的顺序.例如.确保目标依赖项"构建阶段在编译源"之前.

If the above doesn't work double-check the order of the build phases. E.g. make sure that the "Target Dependencies" build phase is before "Compile sources".

这篇关于xcodebuild 在嵌入式项目中找不到标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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