XCTest/XCTest.h not found on old projects built in Xcode 6
I've noticed that XCTest is available to a test target only (in Xcode 6). If you are using using XCTest for any other target (for whatever reason), you will see the XCTest.h not found
error.
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
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.
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.
This error comes up when you have added a file where XCTest is being used outside of a test target. To fix this in AppCode, you can right click on any suspected file and select 'Manage Targets' then make sure only the test target is checked.