XCTest.framework build error XCTest.framework build error objective-c objective-c

XCTest.framework build error


I agree with Mike Weller. You should probably not be linking against the XCTest framework in your actual app code. Remove XCTest framework. Look at the linker errors and remove things that are referencing the framework. Wash, rinse, repeat.

If you have a test target, that is different. What can easily happen during the migration from SenTestKit to XCTest is having the wrong framework search path which causes linking against the Mac OS X framework instead of the iOS framework. This doesn't work.

An easy way to see what the correct framework search path settings are is to create a dummy project, open the build settings for the Tests target and then filter for "Framework Search Path."

I think the correct vanilla paths are:

$(SDKROOT)/Developer/Library/Frameworks     (non-recursive)$(inherited)                                (non-recursive)$(DEVELOPER_FRAMEWORKS_DIR)                 (non-recursive)


Adding to the possible solutions for this problem:

Make sure you did not include the MyApplicationTests.m file
in the project's non-testing targets "Compile Sources" list.

This can happen when you cleaned up folders on the disk
and moved things around manually for example.

Project > Targets > MyApplication > Build Phases > Compile Sources

The most obvious symptom is that you get the XCTest error
when trying to run your app on the iPhone ( or simulator ).

XCTest should not be included in your regular application code as stated
in the other answers as well.


I Just removed the "XCTest.Framework" file from Project Navigator > Targets > 'Project Name' > Build Phases. Then, "Product" (drop-down) > Clean. Did it for me!