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:
Your test class was added to a target, which is not a test target.
Test classes, which are XCTestCase subclasses and contain UI testing or unit testing methods, should only be added to test targets. Remove these classes from any target in your Xcode project that is not a test target in order to resolve your issue as shown in Figure 2.
The XCTest framework was imported into a source file, which is not a test class.
Remove
import XCTest
from any source file that is not a test class in your project in order to resolve your issue as shown in Figure 4.
Document Revision History
Date | Notes |
---|---|
2017-10-25 | New document that describes how to resolve the "Cannot load underlying module for XCTest" error message. |
Copyright © 2017 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2017-10-25