iosswiftunit-testingmodule

Xcode - Unit Test - Compiling for iOS 12 but module has minimum deployment target 13


I am facing issue while running unit tests, Issue is at line below line of code

@testable import PROJECT_NAME

Error: Compiling for iOS 12.1, but module 'PROJECT_NAME' has a minimum deployment target of iOS 13.0: /Users/NAME/Library/Developer/Xcode/DerivedData/ftahdagcflmajidmksgextinoqip/Build/Products/Debug-iphonesimulator/PROJECT_NAME.swiftmodule/x86_64-apple-ios-simulator.swiftmodule

I have tried following

  1. Made sure that deployment target is set to iOS 13.0
  2. Cleaning the build folder and rebuilding and rerunning the unit tests.
  3. Made sure that Simulator I am running is on iOS 13.0+ (current simulator is on iOS 13.5)

but no luck.


Solution

  • You say you made sure the deployment target but did you make sure the deployment target of both the app target and the unit test target? I think the error says that the deployment target of your unit test target is iOS 12.1 but your app target is 13.0.

    Check this value of your unit test target: enter image description here