Articles/Flutter/Troubleshooting Xcode 15 Build Issues in Flutter Projects

Troubleshooting Xcode 15 Build Issues in Flutter Projects

Uncovering solutions to common issues faced when updating to Xcode 15 in a Flutter project using an older version of CocoaPods.

October 7, 2023·1 min read

Updating to Xcode 15 brought a few hurdles in my Flutter project, especially since I was using an older version of CocoaPods, below version 1.13. Here's a breakdown of how I navigated through these issues and got my project back on track.

Step 1: Update Podfile (Flutter / Xcode 15)

Update your Podfile with the following snippet:

RUBY
post_install do |installer|
  installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
          xcconfig_path = config.base_configuration_reference.real_path
          xcconfig = File.read(xcconfig_path)
          xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
          File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
      end
  end
  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'] = '13.0'
      end
  end
end

Step 2: Update Build Phases

  1. Open Xcode
  2. Click "Runner" in the project navigator
  3. Navigate to Targets (Runner in the sidebar)
  4. Click on Build Phases (found in the top bar)
  5. Move "Embed App Extension" above the Run Script step

Step 3: Run Flutter Clean

Once the above changes are done, clean your project with the following command:

BASH
flutter clean

You should now be able to successfully build and run your project.