Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 576
Saif Avatar asked Sep 01 '20 11:09

Saif


People also ask

How do I increase deployment target in Xcode?

To change your deployment target, open up your project file in Xcode and check the setting under Build Settings -> Deployment(...) Check this answer to add earlier devices support.

How do I lower my target deployment in Xcode?

If you haven't already, change the deployment target to the lowest iOS version you want to support, select the project name then select your app target, choose General and change the version in Deployment Info.

What is iOS deployment target in Xcode?

A deployment target is nothing more than the minimum version of the operating system the application can run on. Fire up Xcode and create a new project by choosing the App template from the iOS > Application section.

How do I set unit tests in Xcode?

To add a unit test target to an existing Xcode project, choose File > New > Target. Select your app platform (iOS, macOS, watchOS, tvOS) from the top of the New Target Assistant. Select the Unit Testing Bundle target from the list of targets.


1 Answers

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

like image 83
Manabu Avatar answered Sep 22 '22 09:09

Manabu