Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 364
Erik Kerber Avatar asked Jun 18 '14 00:06

Erik Kerber


Video Answer


2 Answers

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.

like image 59
squarefrog Avatar answered Sep 21 '22 04:09

squarefrog


I was moving files in a project around. All you have to do is select your test files xxxTests.m etc. and in file inspector select target as test and not as a regular target.

like image 28
Jakub Truhlář Avatar answered Sep 19 '22 04:09

Jakub Truhlář