xcode 找不到我的静态库的标头

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9292166/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 23:18:44  来源:igfitidea点击:

Headers for my static library not found

objective-ciosxcodestatic-librariesheader-files

提问by Besi

I have a static library iOS project ProjectCore, that I want to include in the project MyProject.

我有一个静态库 iOS 项目ProjectCore,我想将其包含在该项目中MyProject

In the library project I set:

在我设置的图书馆项目中:

PUBLIC_HEADERS_FOLDER_PATH = $(TARGET_NAME)

So I end up with the following structure

所以我最终得到以下结构

libProjectCore.a
ProjectCore (Folder)
+- ProjectCore.h
+- ProjectCoreUtil.h

In the directory /.../DerivedData/MyProject-xyzabcd/Products/Release-iphoneos/

在目录 /.../DerivedData/MyProject-xyzabcd/Products/Release-iphoneos/

Now I setup MyProject

现在我设置 MyProject

  • Add ProjectCoreas a git submodule next to MyProject.xcodeproj
  • Drag the ProjectCore.xcodeprojto Xcode
  • Add the project as a dependency
  • Link against libProjectCore.a
  • I set it's "Header Search Path" to $(BUILT_PRODUCTS_DIR)which should point to the folder above.
  • 添加ProjectCore为旁边的 git 子模块MyProject.xcodeproj
  • 拖拽ProjectCore.xcodeproj到 Xcode
  • 添加项目作为依赖
  • 链接反对 libProjectCore.a
  • 我将其设置为“标题搜索路径”,$(BUILT_PRODUCTS_DIR)该路径应指向上面的文件夹。

Curiously neither of the approaches work:

奇怪的是,这两种方法都不起作用:

#import "ProjectCore.h" // With the (Recursive Flag set for the Headers)
#import <ProjectCore/ProjectCore.h> // The way RestKit does it

采纳答案by Johnnywho

I suggest using ${TARGET_BUILD_DIR}/ProjectCorein User Header Search Paths- it works for me.

我建议使用${TARGET_BUILD_DIR}/ProjectCorein User Header Search Paths- 它对我有用。