Xcode - 根据Target导入具有相同名称的不同头文件 [英] Xcode - Importing different header file with same name based on Target

查看:755
本文介绍了Xcode - 根据Target导入具有相同名称的不同头文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个目标的项目,每个目标都构建了一个非常相似的应用版本,但具有不同的图像资源和plists。对于没有问题的plists / images,我使用的是ShareKit和Appirater框架,它们的头文件带#defines用于配置。对于每个版本,我认为需要导入此头文件的不同版本,因为每个目标构建的每个应用程序的配置都不同。

I have a project with multiple targets each of which builds a pretty similar versions of the app but with different images assets and plists. For plists/images that's fine but I use the ShareKit and Appirater frameworks which have header files with #defines for their config. For each version I believe need to import a different version of this header file, as the config is different for each app built by each target.

因此目标A具有SHConfig。 h
和目标B有一个不同的SHConfig.h

So target A has SHConfig.h and target B has a DIFFERENT SHConfig.h

我可以编辑这些框架的源代码,根据目标导入不同的头文件但是当我来升级框架时凌乱。

I could edit the source for these frameworks to import different headers based on the target but that'd be messy when I come to upgrade the frameworks.

有没有更好的方法根据目标导入不同的头文件(具有相同的名称)?

Is there a better way to import different header files (with the same name) based on the target?

推荐答案

假设它们位于不同的目录中,请在每个目标中设置标题搜索路径,以便将正确的目录放在第一位。

Assuming they're in different directories, set the Header Search Paths in each target to put the correct directory first.

您可能希望将其设置为类似 $(SRCROOT)/ foo:$(HEADER_SEARCH_PATHS),但我不确定是否是必要的。

You may want to set it to something like $(SRCROOT)/foo:$(HEADER_SEARCH_PATHS), though I'm not sure whether that's necessary.

这篇关于Xcode - 根据Target导入具有相同名称的不同头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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