Cannot load underlying module for XCTest

brduca picture brduca · Apr 30, 2015 · Viewed 75.4k times · Source

I'm working in swift on Xcode and by default it creates a test file that references XCTest.

When I set the target membership to my main project it causes this error

Cannot load underlying module for XCTest

If this target membership is not set the tests runs properly and everything works fine.

PS: I'm new to swift and it's probably a dumb question (please enlighten me)

Answer

Aaron Zinman picture Aaron Zinman · Sep 10, 2015

Double check that the file in question is not in the main target but instead only the test target. Only the test target will have that framework to import.