iOS How to solve the error message about Module was not compiled for testing
Introduction
This article shows how to solve the error message about “Module was not compiled for testing” on XCTest code.
The module was installed by Carthage.
Background
When I try to do my test code on the XCTest, sometimes I would like to use some modules which was installed by Carthage.
import XCTest @testable import {Your Project}
Using “import” sentence
At first, I tried to use the import sentence to use the module as below.
import "SOME MODULE"
I faced on the error message.
framework not found
Using “@testable” sentence
Secondly, I tied to se the @testable sentence as below.
@testble import "SOME MODULE"
Xcode gave me another error message.
Module "SOME MODULE" was not compiled for testing
Solution
It need to include the module at the
[TestTarget] -[Target] - [BuildPhases] - [Link Binary With Libraries]
It works fine!