NeilInglis NeilInglis - 1 year ago 154
iOS Question

Xcode - Importing different header file with same name based on Target

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.

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?

Answer Source

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

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download