348

I'm getting this below warning message in my Xcode 10.1.

The iOS Simulator deployment targets are set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.1.

My simulator os in 12.1 Xcode 10.1

And I updated my pod file.

enter image description here

My deployment target is 9.0

enter image description here

In my target

enter image description here

Naresh
  • 16,698
  • 6
  • 112
  • 113
  • Please verify the target in the https://user-images.githubusercontent.com/5786033/45890297-f23a1d00-bdc2-11e8-885c-039432d8fbc2.png, Edit : In the framework – Vinaykrishnan Feb 15 '19 at 07:10
  • @ Vinaykrishnan, I checked it's 9.0 – Naresh Feb 15 '19 at 07:11
  • 5
    This guys had the same issue check this could help you, https://github.com/flutter/flutter/issues/22123 and https://github.com/CocoaPods/CocoaPods/issues/8069 . Open your `Xcode` and there is `File` upper-left next to Apple icon, then open `Workspace Settings` and change the build system to` Legacy Build System`. And if you haven't tried this yet https://stackoverflow.com/a/52552878/2323806 – Vinaykrishnan Feb 15 '19 at 07:16

29 Answers29

513

You can set up your podfile to automatically match the deployment target of all the podfiles to your current project deployment target like this :

post_install do |installer|
 installer.pods_project.targets.each do |target|
  target.build_configurations.each do |config|
   config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
  end
 end
end
rmtheis
  • 5,992
  • 12
  • 61
  • 78
Tao-Nhan Nguyen
  • 5,508
  • 2
  • 13
  • 9
  • 1
    thanks for the great answer! Curious - would it be possible to automate the '9.0' on line four ... so that it just takes the deployment target from your main project?? – Fattie May 16 '20 at 20:57
  • 15
    What if you already have another post install hook? I'm getting an error indicating multiple post installs is not supported – George Salamanca May 22 '20 at 19:27
  • This does not seem to work if the minimum deployment target of a pod is already higher than the one enforced. So we'd need to take the original value into account. – Grigory Entin Jun 23 '20 at 02:48
  • 5
    @GeorgeSalamanca, you can put into the same post_install block – Simon Hansen Aug 29 '20 at 16:03
  • 14
    @Fattie I believe you can just do `config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'` – rmp251 Sep 17 '20 at 16:48
  • 4
    I inserted the snippet in podfile but it doesn't work – StackGU Oct 08 '20 at 10:05
  • 7
    Hi @Tao-Nhan Nguyen, Where should I add the code it shows? Thank you – Miguel Espeso Nov 02 '20 at 18:56
  • 3
    Insert to Podfile in your Ios platform. You should "pod repo update" & "pod install" after insert. – LacOniC Dec 07 '20 at 03:18
  • 1
    I got this error `[!] Invalid 'Podfile' file: [!] Specifying multiple 'post_install' hooks is unsupported.` but I don't see any other post_install in my podfile – Raphael Pinel Jan 11 '21 at 10:51
  • 1
    post_install already exists because of the Flipper setup. You need to combine those into a single post_install – Oskar Jan 22 '21 at 07:53
  • I'm very new to programming and I have no idea where to find that: post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0' end end end can you tell me where to find it? – Tom May 24 '21 at 22:27
  • 3
    @Tom Add it to the end of your Podfile – Lane Faison May 27 '21 at 18:58
  • 1
    fatal error: 'Flutter/Flutter.h' file not found. after updating . i have this – Sras Aug 31 '21 at 07:01
  • fatal error: 'Flutter/Flutter.h' file not found. after updating as suggested. Did not solve the problem for me.. – edn Oct 07 '21 at 15:10
  • 1
    Here is the updated answer as of late 2021: https://stackoverflow.com/a/70316588/8094969 – bm888 Dec 11 '21 at 15:50
  • 1
    if anyone using this solution runs into `fatal error: 'Flutter/Flutter.h' file not found`, you can try adding this line: `flutter_additional_ios_build_settings(target)` back under `installer.pods_project.targets.each do |target|`. – Nathan Tew Dec 26 '21 at 09:44
  • where do you place this? – Franco Altuna Jan 03 '22 at 14:46
  • @FrancoAltuna in your Podfile – Yves Boutellier Jan 09 '22 at 10:41
131

The problem is in your pod files deployment target iOS Version not in your project deployment target iOS Version, so you need to change the deployment iOS version for your pods as well to anything higher than 8.0 to do so open your project workspace and do this:

1- Click on pods.

2- Select each project and target and click on build settings.

3- Under Deployment section change the iOS Deployment Target version to anything more than 8.0 (better to try the same project version).

4- Repeat this for every other project in your pods then run the app.

see the photo for details enter image description here

Community
  • 1
  • 1
Ahmed El-Bermawy
  • 2,173
  • 1
  • 14
  • 16
  • 111
    The Pods project is auto generated. You shouldn't mess with it. – Mihai Damian Aug 08 '19 at 13:08
  • 2
    I did not mess with the pod (although i found no problem doing so as it's made by human ..) i just changed the version of the iOS that it should be targeted which is acceptable. and this is a better solution than the accepted one which is forcing you to decrease your own project iOS version. – Ahmed El-Bermawy Aug 09 '19 at 19:11
  • 11
    I'm not saying that the accepted solution is better, just that editing generated files is bad practice. Any file generated by Cocoapods shouldn't be edited manually since it may get overwritten in the future. If you don't like the output you can make adjustments from the Podfile via post_install. These files shouldn't even be committed on your repo. – Mihai Damian Aug 20 '19 at 07:48
  • @MihaiDamian Re "make adjustments from the Podfile via post_install": how would you do that for this scenario? – gkeenley Sep 20 '19 at 15:36
  • I have the same warning, but the build is success, So is this important and will make problem on relase ? – Muhammad Dec 10 '19 at 22:49
  • 1
    @Muhammad It have to be answered from the POD developer himself, anyway for me I would not leave any warnings for my project with release – Ahmed El-Bermawy Dec 12 '19 at 12:54
  • Because changing the podfiles directly doesn't save anything into git, it won't stick and installing a new pod will undo it. One of my major issues was having AppCenter not build properly because of the version issues. Changing it manually won't make any difference, you have to modify the podfile and commit the code up, as per Tao's answer – Matt Fletcher Jan 09 '20 at 10:41
  • 2
    You can select all of them and change at once – Rami Alloush Sep 18 '20 at 01:19
  • How to make these changes persist? – discodancer Dec 22 '21 at 15:58
  • 1
    This helped me, thanks! – Ankit Maheshwari Jan 06 '22 at 06:12
120

Instead of specifying a deployment target in pod post install, you can delete the pod deployment target for each pod, which causes the deployment target to be inherited from the Podfile.

You may need to run pod install for the effect to take place.

platform :ios, '12.0'

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
      end
    end
  end
craft
  • 2,017
  • 1
  • 21
  • 30
trishcode
  • 3,299
  • 1
  • 18
  • 25
  • 4
    if anyone using this solution runs into `fatal error: 'Flutter/Flutter.h' file not found`, you can try adding this line: `flutter_additional_ios_build_settings(target)` back under `installer.pods_project.targets.each do |target|`. – Nathan Tew Dec 26 '21 at 09:44
  • If you remove the deployment target for the pods, what happens in the scenario where the pod has a higher deployment target than the pods project? For example, what if the app had a deployment target of iOS 12 and the podfile specified iOS 12 so that the pods project had a deployment target of iOS 12, but one of the pods has a deployment target of iOS 13 and we just wiped out that deployment target. Would the app attempt to build the pod and produce an error for the pod that had a deployment target of iOS 13? – tjpaul Feb 01 '22 at 02:44
64

Iterating over the answer from Tao-Nhan Nguyen, accounting the original value set for every pod, adjusting it only if it's not greater than 8.0... Add the following to the Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if Gem::Version.new('8.0') > Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '8.0'
      end
    end
  end
end
Grigory Entin
  • 1,617
  • 18
  • 20
22

We can apply the project deployment target to all pods target. Resolved by adding this code block below to end of your Podfile:

post_install do |installer|
  fix_deployment_target(installer)
end

def fix_deployment_target(installer)
  return if !installer
  project = installer.pods_project
  project_deployment_target = project.build_configurations.first.build_settings['IPHONEOS_DEPLOYMENT_TARGET']

  puts "Make sure all pods deployment target is #{project_deployment_target.green}"
  project.targets.each do |target|
    puts "  #{target.name}".blue
    target.build_configurations.each do |config|
      old_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
      new_target = project_deployment_target
      next if old_target == new_target
      puts "    #{config.name}: #{old_target.yellow} -> #{new_target.green}"
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = new_target
    end
  end
end

Results log:

fix pods deployment target version warning

Cuong Lam
  • 3,242
  • 2
  • 22
  • 19
20

If anyone came here from react native issue, just delete the /build folder and type react-native run ios

9

Try these steps:

  1. Delete your Podfile.lock
  2. Delete your Podfile
  3. Build Project
  4. Add initialization code from firebase
  5. cd /ios
  6. pod install
  7. run Project

This was what worked for me.

calimarkus
  • 9,955
  • 2
  • 28
  • 48
Patrick Kelly
  • 153
  • 1
  • 4
9

This solution worked for me for Flutter. open {your_project_root_folder}/ios/Podfile and replace the post_install block with this

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end
Dr Manhattan
  • 13,537
  • 6
  • 45
  • 41
8

For Swift

If you are using CocoaPods with Xcode 12, then you have probably seen this error:

The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.

This is happening because support for iOS 8 has been dropped, but the minimum deployment target for the pod is iOS 8.

Until this is fixed, you can add the following to your Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end

This will remove the deployment target from all the pods in your project and allows them to inherit the project/workspace deployment target that has been specified at the top of Podfile.

For React Native

Delete the ./project-root/ios/build folder and type react-native run ios

For Cordova

<preference name="deployment-target" value="8.0" />
7

If your are come from react-native and facing this error just do this

  1. Open Podfile(your project > ios>Podfile)
  2. comment flipper functions in podfile as below
#use_flipper!
 #post_install do |installer|
   #flipper_post_install(installer)
 #end
  1. In terminal inside IOS folder enter this command pod install

yep, that is it hope it works to you

Abdulkadir Ugas
  • 415
  • 5
  • 13
7

if anybody is experiencing is issue while updating to the latest react native, try updating your pod file with

  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
      end
    end
   end
sandrina-p
  • 3,794
  • 8
  • 32
  • 60
Kingsley Akpan
  • 213
  • 3
  • 3
7

Simple fix that worked for me in Flutter:

  1. Delete Podfile and Podfile.lock
  2. Run app: This will create a new Podfile. This will probably still fail with an error.
  3. In the new Podfile, uncomment and change the 2nd line to platform :ios, '12.0' (or other min version you want to target)
  4. Run app again, now without errors
lenz
  • 2,193
  • 17
  • 31
7

All you need to do is just uncomment the following line

# platform :ios, '8.0'

OR

# platform :ios, '9.0'

etc...

and then open iOS folder in the terminal and pass those commands:

% pod repo update
% pod install
Grokify
  • 15,092
  • 6
  • 60
  • 81
matua
  • 597
  • 4
  • 12
6

I solved this problem, I changed build system to Legacy Build System from New Build System

In Xcode v10+, select File > Project Settings

In previous Xcode, select File > Workspace Settings

enter image description here

Change Build System to Legacy Build System from New Build System --> Click Done.

enter image description here

Anonsage
  • 8,030
  • 5
  • 48
  • 51
Naresh
  • 16,698
  • 6
  • 112
  • 113
2

For Flutter use this

platform :ios, '10.0'

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end
Jithin U. Ahmed
  • 1,495
  • 1
  • 19
  • 29
2

Solve this issue by updating the podfile.

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|        
       config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0' // you can change this version as per your requirments.
    end
  end
end 

You have to use these line on podfile then your app will run.

Md. Al-Amin
  • 690
  • 3
  • 13
1

for cordova developers having this issue

try to set

<preference name="deployment-target" value="8.0" />

in config.xml

mario.van.zadel
  • 2,919
  • 14
  • 23
CGN
  • 579
  • 4
  • 13
1

If anyone is getting this problem in 2021 after updating XCode to v13, here's a fix that worked for me:

https://github.com/facebook/react-native/issues/31733#issuecomment-924016466

However, this may not work for all react-native versions, it worked on v0.64 for me.

I used Xcode to create the dummy swift file so I automatically got a request for "Bridging Header"

enter image description here

Hopefully, this would be resolved in a future release.

Edmund1645
  • 309
  • 1
  • 2
  • 13
1

Worked for me:

rm ios/Podfile
flutter pub upgrade
flutter pub get
cd ios && pod update
flutter clean && flutter run
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install 
Lay Leangsros
  • 9,156
  • 7
  • 34
  • 39
1

most of the above did not work for me. If you dig around you will see that you aren't supposed to run pod install by hand. What worked for me was making sure my physical device was registered with xcode.

  • open xcode workspace for ios. select your device (connected via usb most likely) and click Run. This will prompt you to let xcode register your device.
  • xcode build will most likely fail which is ok - see next steps
  • Quit Xcode!
  • cd ios
  • rm -fR Podfile Podfile.lock Pods
  • in android studio choose the device in question and c
HanDoJin
  • 99
  • 4
1

This is how I solved this issue with Firebase 10.1 and Xcode 14.1:

  1. Open Xcode, select Product > Analyze to get all the IPHONEOS_DEPLOYMENT_TARGET warnings. Close Xcode.
  2. Rename DerivedData directory in /Users/YourUserName/Library/Developer/Xcode/ to DerivedData-old
  3. Open Terminal, in your project directory:

pod cache clean --all && pod deintegrate && pod install --repo-update

  1. Open Xcode. Click your Project file. Select "Firebase" in the TARGETS section. Then do this change:

Select iOS deployment target value, select 11.0, then select Other and type 10.0, then enter

  1. All the warning should be gone and a single warning from Xcode should be there: "Update to recommended settings"

enter image description here

  1. Click on Perform Changes button
  2. Restart Xcode

There is a detailed discussion about this at the Firebase project repository.

Luke
  • 965
  • 8
  • 21
0

first change the deployment to your choose : like '11.0' and add this step in the last of your pod file

end
post_install do |installer|
 installer.pods_project.targets.each do |target|
  target.build_configurations.each do |config|
   config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
  end
 end
end
0

I had the same issue building my React Native project

cocoapods version update worked for me (upgraded from 1.8.4 to 1.11.2)

0

Xcode > Runner > Info deployment Target > IOS Deployment Target: 11 .

open terminal :

pod cache clean --all

.

pod update
ishak Akdaş
  • 43
  • 2
  • 9
0

(flutter)In my case I accidentally imported dart.js so if it was working a moment ago and it just stopped on reload or new restart check your imports

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 21 '22 at 01:31
0

For flutter this is what I'm using inside <project_root>/ios/Podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
  
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS"] = "armv7"
    config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
  end
end
Imran Zahoor
  • 2,521
  • 1
  • 28
  • 38
0

delete pods folder and podfile.lock,increase deployment target in podfile as well as xcode

Prakritii
  • 11
  • 1
0

I added this below import and I saw this error. If this helps anyone. It was unused import.

import 'dart:js';
-4

This is a known issue on M1 MacBooks. Run flutter upgrade and that should fix it.

Currently working on M1 Mackbook 12.0.0 Flutter 2.10.0 Dart 2.16.0

Gdarwish
  • 1
  • 1