Technical Q&A QA1954

Cannot load underlying module for XCTest

Q:  My Xcode project fails compiling with a "Cannot load underlying module for XCTest" error message. How do I resolve this issue?

A: You may be getting this error for any of the following reasons:

Figure 1  Xcode fails compiling: The CalcUITests class is a member of both the target being tested (Calc) and UI test target (CalcUITests).
Figure 2  Xcode successfully builds: The CalcUITests class is a member of the CalcUITests UI test target.
Figure 3  Xcode fails compiling: Calculator, a class from the CalculatorKit framework, imports the XCTest framework.
Figure 4  Xcode successfully builds: The Calculator no longer imports the XCTest framework.


Document Revision History


DateNotes
2017-10-25

New document that describes how to resolve the "Cannot load underlying module for XCTest" error message.