240
votes

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

16
Please verify the target in the user-images.githubusercontent.com/5786033/…, Edit : In the frameworkVinaykrishnan
@ Vinaykrishnan, I checked it's 9.0iOS
This guys had the same issue check this could help you, github.com/flutter/flutter/issues/22123 and 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 stackoverflow.com/a/52552878/2323806Vinaykrishnan

16 Answers

355
votes

You can setup 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
113
votes

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

73
votes

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

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
54
votes

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
17
votes

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

9
votes

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

9
votes

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.

9
votes

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

7
votes

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

5
votes

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
4
votes

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" />
4
votes

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
1
votes

for cordova developers having this issue

try to set

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

in confix.xml

1
votes

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
0
votes

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
votes
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