XCTest/XCTest.h not found on old projects built in Xcode 6

Erik Kerber picture Erik Kerber · Jun 18, 2014 · Viewed 72.4k times · Source

I have a few projects I'm trying to build with Xcode 6 Beta 2. The projects all have some type of library that uses XCTest (Kiwi/XCTest and Specta) that don't build in Xcode 6 because XCTest/XCTest.h cannot be found.

fatal error: 'XCTest/XCTest.h' file not found
#import <XCTest/XCTest.h>

I noticed that XCTest.framework is no longer in the "Link Libraries with Binaries" build phase list, but that's fine because when I create a new project with Xcode 6 it appears the library is linked in automatically.

Perhaps of some relevency, my XCTest-needing dependencies are all brought in via Cocoapods.

Is there anything I'm unaware of that I need to update with my project?

Answer

squarefrog picture squarefrog · Jul 9, 2014

Note: This may not be needed for any projects created in Xcode 7.

CocoaPods had a fix for this here and here


In order to fix this for any CocoaPod dependencies you need to add the following to FRAMEWORK_SEARCH_PATHS in any Pod target that requires XCTest (e.g. Kiwi, Specta, FBSnapshotTestCase, etc).

$(PLATFORM_DIR)/Developer/Library/Frameworks

screenshot

This will allow you to reference XCTest in any dependencies you may have. This may be fixed in a future update of CocoaPods, or the Pod you are referencing, so you may want to remove it later.

It is not detrimental to earlier versions of Xcode so should be safe to use.