Error: No such module 'XCTest' when building iOS project

80 views Asked by At

I am using XCTest for unit testing in my iOS project in Xcode. When I try to build my project, I receive this error message:

No such module 'XCTest'

I have already verified that XCTest.framework is included in the "Link Binary With Libraries" section of my target's build phases.

I have tried the following troubleshooting steps without success:

  • Cleaning the build folder and rebuilding the project.
  • Verifying that XCTest is correctly imported in my test files (import XCTest).
  • Ensuring that my project's target includes XCTest as a dependency.

Despite these efforts, I am still encountering the error.
Can someone please provide guidance on how to resolve this issue?

2

There are 2 answers

3
Rafa Log On

have you try also to close xcode and open again? sometimes happens

0
Bravman On

I solved it with this in case anyone comes across the same issue. I am on xcode 15.2.

Based on the information in this link, set:

SYSTEM_FRAMEWORK_SEARCH_PATHS=YES

in your target's Build settings