40

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.

Saif
  • 2,678
  • 2
  • 22
  • 38

2 Answers2

91

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

Manabu Nakazawa
  • 1,983
  • 22
  • 23
  • 10
    So that you don't have to do this again in the future, select the `iOS Deployment Target` row and press `delete` to revert to the default. – Robin Stewart Jun 08 '21 at 00:16
  • 2
    Just to add to the good note above this (reverting to the default target). To 'set' the default, the 'iOS Deployment Target' needs to be set in the 'Project' build settings, not the main target. – bauerMusic Oct 11 '21 at 06:10
10

Change all Pods to Your deployment target if is 12.0 and your deployment target 11.0 change all to 11.0

enter image description here

  • 1
    You should set the minimum version in your pod file and rund pod install again. – Tbi Jul 20 '23 at 19:29