'flutter) The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0

Debuging the ios simulator outputs the following error.

warning: 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.5.99.

And the Podfile of ios is as follows.

# Uncomment this line to define a global platform for your project
platform :ios, '10.0' #9.0 -> 10.0 edit

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

IPHONEOS_DEPLOYMENT_TARGET of ios/Runner.xcodeproj/project.pdxproj is 9.0.

IPHONEOS_DEPLOYMENT_TARGET = 9.0;

This project has been going well until recently. However, there is this error all of a sudden.

May I know how to solve this problem?

It's frustrating that I can't do it all of a sudden.



Solution 1:[1]

So this error comes from straight from your actual dart code, for example if you doing bad coding with forEach and firstWhere mixing loops etc., it will throw 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0 error. Also always remove if you have import 'dart:html'; and not been used.

You will get this error no matter what until you fix your code. Even you do flutter create myproject and copy your lib folder error will not go away. Most answers will say try to change Podfile, delete ios folder and run create command again, try to change flutter master to stable version, even do the flutter pub cache repair command etc., NONE will work. Undo your last commit or code and it will work again guaranteed.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 test