4
votes

I have a project that was previously running in XCode 7, under Swift 2.2. However, I started migrating it to Xcode 8 and Swift 2.3 (Swift 3 will come later). This is my first time migrating a project, so I'm fairly new to a lot of concepts.

I keep getting the following error: 'JBBarChartView.h'file not found.

This is how my project looks like (blurred out the unimportant parts for privacy reasons)

enter image description here

The blue arrow points to the Bridging Header. This is what my bridging header looks like: enter image description here

and this here is my actual folder structure. enter image description here

The important Header Files, such as the JBBarChartView.h, are inside the Vendor Folder. For some odd reason, Xcode simply cannot find the files, and thus fails to import the Bridging Header.

So far what I have tried is:

  • For the related Target, I have set Swift Compiler - General > Objective-C Bridging Header to the correct location.
  • I have set the Header Search Paths for the Target to ../../${SRCROOT} and recursive.
  • I have also selected YES on Always search user paths
  • And my User Header Search Paths are also: ../../${SRCROOT} and recursive. (manually, in my build settings)
  • I also have an xconfig file which looks like this: HEADER_SEARCH_PATHS = "../$(SRCROOT)/**" (among other, but they are all separated by a blank space.)
  • I have too cleaned the DerivedData Folder, and restarted Xcode several times.

No matter what I try, for some odd reason Xcode can't find those headers. Does anybody have an idea what I could try?

1

1 Answers

0
votes

This ../../${SRCROOT} looks wrong - Very possibly you want ${SRCROOT}/../Vendor/ (or something close).

When you add that, it should expand the SRCROOT macro and show you the actual path being generated... Does that look correct?

For example, when I use:

${SRCROOT}/../Vendor/

I get:

/Users/DonMag/Source/TestProj/../Vendor/

Which would put my Vendor files that I'm looking for in:

/Users/DonMag/Source/Vendor/

My Steps to Resolve This:

Create a new FindMe.h file in your project. Put #define FOUNDIT 1 in it. Add #include "FindMe.h" to the top of AppDelegate.m.

Add to didFinishLaunchingWithOptions:

#ifdef FOUNDIT
    NSLog(@"Woo Hoo");
#endif

Naturally, that should compile and run without issue.

Next, delete the reference to FindMe.h from your project, and move FindMe.h up one folder level. Try to compile --- and you should get a "FindMe.h not found" error.

Add ${SRCROOT} as a Header Search Path

Try to compile / run. That should work. If so...

Move FindMe.h up another folder level, and change Header Search Path to ${SRCROOT}/../. Compile/run --- should work.

Keep following that process - move .h one level (up or down into a new folder), edit your Header Search Path, build/run to confirm... until you've reached the target folder of your "Vendor" header files.