'Flutter Unable to build for IOS

I am using flutter 2.10.3 I have created a new project i was able to run on simulator iphone 8 but when i run flutter build ios i am getting below error.

    The following build commands failed:
                CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'vibration' from project 'Pods')
                Ld

/Users/bilalrabbi/Library/Developer/Xcode/DerivedData/Runner-eqtwcanhgaiurgblzcjnjgoffipl/Build/Intermediates.noindex/Pods.build/Release-iphoneos/shared_preferences_ios.buil
                d/Objects-normal/armv7/Binary/shared_preferences_ios normal armv7 (in target 'shared_preferences_ios' from project 'Pods')
               (2 failures)

and

[ +320 ms] Uncategorized (Xcode): Command CompileSwiftSources failed with a nonzero exit code

[   +6 ms] Error (Xcode): Framework not found Flutter

I have removed pod files. delete derived data. update pod cache but nothing seems to work. When i try to build again i am getting this error Here is my PodFile

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

# 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)
    target.build_configurations.each do |build_configuration|
      build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
    end
  end
end

I also tried with platform :ios, '11.0'



Solution 1:[1]

try deleting flutter SDK and re-install it then run these commands in the project folder

flutter clean
flutter pub upgrade
flutter pub get

then switch to the ios folder and run

pod install

Now try to build.

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 Ashutosh singh