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

3

49

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.

Coextensive answered 1/9, 2020 at 11:42 Comment(2)
are you running the tests in xcode itself or running them manually using xcodebuild command?Oliphant
make sure that the simulator you have selected to run to is also running iOS 13. It will compile based on that selectionOliphant
I
103

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

Individually answered 14/9, 2020 at 11:6 Comment(2)
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.Whipstall
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.Limitary
M
12

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

Meingoldas answered 18/5, 2021 at 12:51 Comment(1)
You should set the minimum version in your pod file and rund pod install again.Hullo
G
2

In my case, I noticed I was working with a stale project.pbxproj file , I had to delete everything in ios folder and regenerate them after setting the target version to 13.0

Gahl answered 25/10, 2023 at 10:15 Comment(2)
Could you please provide additional information about the issue you are facing? The more details you can provide, the better we will be able to understand you. Thank you.Zea
I was having the same issue as stated above i.e. compiling for iOS 12 while module has a min target of 13, I changed the setup in the pod file and then also made sure the simulator setup was correct, however, the issue persisted, then I noticed my project.pbxproj file under my iOS directory was stale and it was set up to iOS 12 , then I was able to delete iOS and regenerate it to make sure project.pbxproj is setup to iOS 13 instead of 12, then I was able to build successfully. I am working with expo , without Xcode GUIGahl

© 2022 - 2024 — McMap. All rights reserved.