在 XCode 中包含来自自定义框架的标头

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3938194/
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 19:50:12  来源:igfitidea点击:

Including headers from custom framework in XCode

xcodeframeworksincludeheadersearch-path

提问by Kornel

Am I supposed to adjust FRAMEWORK_SEARCH_PATHSor HEADER_SEARCH_PATHSwhen I add custom frameworks to the project?

我应该调整FRAMEWORK_SEARCH_PATHS还是HEADER_SEARCH_PATHS当我向项目添加自定义框架时?

I have MainProject.xcodeprojectthat links SomeFramework.frameworkthat's simply dragged from "Products" in SomeFramework.xcodeprojectto "Link with Binary Libraries" build phase in main project.

我有MainProject.xcodeproject一些链接SomeFramework.framework,它只是从“产品”拖到SomeFramework.xcodeproject主项目中的“链接与二进制库”构建阶段。

Framework contains all required headers in its Headersdirectory. However, in my project I can't simply use:

框架在其Headers目录中包含所有必需的头文件。但是,在我的项目中,我不能简单地使用:

#import <SomeFramework.h> // I'm pretty sure this file exists

to include this header. Build fails "No such file or directory". Compiler flags include -F…/SomeFramework/build/Releaseand that directory contains framework with Headersdirectory symlink in it.

包括这个标题。构建失败“没有这样的文件或目录”。编译器标志包括-F…/SomeFramework/build/Release并且该目录包含带有Headers目录符号链接的框架。

(BTW: this is for Mac OS X. I don't care about iPhone.)

(顺便说一句:这是针对 Mac OS X 的。我不在乎 iPhone。)

采纳答案by w-m

Just adding the path to the directory containing the framework to FRAMEWORK_SEARCH_PATHS will work. Unless it's a typo, your problem seems to be

只需将包含框架的目录的路径添加到 FRAMEWORK_SEARCH_PATHS 即可。除非是打字错误,否则您的问题似乎是

#import <SomeFramework.h>

which should be

这应该是

#import <SomeFramework/SomeFramework.h>