iOS build fails: 'Flutter/Flutter.h' file not found

I’m on a MacBook Air 2025 M4 (Apple Silicon) using Flutter 3.35.5 on channel stable, Xcode 26.0.1, and CocoaPods 1.16.2.

Actual Setup:

Component Version
macOS 15.0 Sequoia
CPU Apple M4 (ARM64)
Flutter 3.35.5 on channel stable
Dart 3.9.2
DevTools 2.48.0
CocoaPods 1.16.2
Xcode 26.0.1 Build 17A400

Since updating Flutter from 3.24 → 3.35, iOS builds consistently fail with the following errors (not matter if simulation or real device, also ios version no matter):

fatal error: 'Flutter/Flutter.h' file not found

Error logs:

app_links
/Users/myuser/.pub-cache/hosted/pub.dev/app_links-6.4.1/ios/app_links/Sources/app_links/AppLinksIosPlugin.swift
/Users/myuser/.pub-cache/hosted/pub.dev/app_links-6.4.1/ios/app_links/Sources/app_links/AppLinksIosPlugin.swift:1:8 Unable to find module dependency: 'Flutter'
import Flutter
       ^

flutter_native_splash
/Users/myuser/.pub-cache/hosted/pub.dev/flutter_native_splash-2.4.6/ios/flutter_native_splash/Sources/flutter_native_splash/include/flutter_native_splash/FlutterNativeSplashPlugin.h
/Users/myuser/.pub-cache/hosted/pub.dev/flutter_native_splash-2.4.6/ios/flutter_native_splash/Sources/flutter_native_splash/include/flutter_native_splash/FlutterNativeSplashPlugin.h:1:9 'Flutter/Flutter.h' file not found

flutter_secure_storage
Clang dependency scanner failure: While building module 'flutter_secure_storage' imported from flutter_secure_storage-7125a5c1.input:1:
In file included from <module-includes>:1:
In file included from /Users/myuser/Documents/mycompany/auftrag/AppName/name-app/ios/Pods/Headers/Public/flutter_secure_storage/flutter_secure_storage-umbrella.h:13:
/Users/myuser/Documents/mycompany/auftrag/AppName/name-app/ios/Pods/Headers/Public/flutter_secure_storage/FlutterSecureStoragePlugin.h:11:9: fatal error: 'Flutter/Flutter.h' file not found
flutter_secure_storage-7125a5c1.input:1:1: fatal error: could not build module 'flutter_secure_storage'


Unable to find module dependency: 'flutter_secure_storage'

/Users/myuser/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/ios/Classes/SwiftFlutterSecureStoragePlugin.swift
/Users/myuser/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/ios/Classes/SwiftFlutterSecureStoragePlugin.swift:8:8 Unable to find module dependency: 'Flutter'
import Flutter
       ^

path_provider_foundation
/Users/myuser/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.2/darwin/path_provider_foundation/Sources/path_provider_foundation/messages.g.swift
/Users/myuser/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.2/darwin/path_provider_foundation/Sources/path_provider_foundation/messages.g.swift:10:10 Unable to find module dependency: 'Flutter'
  import Flutter
         ^

sign_in_with_apple
Clang dependency scanner failure: While building module 'sign_in_with_apple' imported from sign_in_with_apple-b77ac708.input:1:
In file included from <module-includes>:1:
In file included from /Users/myuser/Documents/mycompany/auftrag/AppName/name-app/ios/Pods/Headers/Public/sign_in_with_apple/sign_in_with_apple-umbrella.h:13:
/Users/myuser/Documents/mycompany/auftrag/AppName/name-app/ios/Pods/Headers/Public/sign_in_with_apple/SignInWithApplePlugin.h:1:9: fatal error: 'Flutter/Flutter.h' file not found
sign_in_with_apple-b77ac708.input:1:1: fatal error: could not build module 'sign_in_with_apple'


Unable to find module dependency: 'sign_in_with_apple'

/Users/myuser/.pub-cache/hosted/pub.dev/sign_in_with_apple-7.0.1/ios/Classes/SignInWithAppleAvailablePlugin.swift
/Users/myuser/.pub-cache/hosted/pub.dev/sign_in_with_apple-7.0.1/ios/Classes/SignInWithAppleAvailablePlugin.swift:6:8 Unable to find module dependency: 'Flutter'
import Flutter
       ^

What I’ve verified

  1. flutter clean + flutter pub get
  2. pod install --repo-update
  3. Deleted DerivedData
  4. Verified Generated.xcconfig exists
  5. Verified FLUTTER_ROOT path is correct
  6. Tried both in Podfile use_frameworks! :linkage => :static and modular headers
  7. Tried flutter build ios --no-codesign

Still, the same errors appear.

Observations

  • I couldn’t find a solution with ChatGPT or searching in the Internet like on Stackoverflow
  • Since Flutter 3.35, Flutter.framework is no longer under .../engine/ios/Flutter.framework, but instead part of .../engine/ios/Flutter.xcframework/ios-arm64/Flutter.framework
  • After pod install, there is no Pods/Flutter/Flutter.xcframework folder at all.
  • Running flutter build ios does not generate the framework either — Flutter seems to depend on dynamic build-time injection, but the plugins expect static headers at build time.
  • On my Windows machine, the exact same project and plugin versions build perfectly (obviously without actual iOS compilation).

Podfile

platform :ios, '15.0'

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. Run flutter pub get 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}"
end

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

target 'Runner' do
  use_frameworks! :linkage => :static
  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|
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
      config.build_settings['HEADER_SEARCH_PATHS'] ||= ['$(inherited)', '${PODS_ROOT}/../Flutter/Flutter.framework/Headers']
      config.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= ['$(inherited)', '${PODS_ROOT}/../Flutter']
      config.build_settings['DEFINES_MODULE'] = 'YES'
    end
  end
end

pubspec.yaml

name: myapp
description: "blablabla description"
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1

environment:
  sdk: ^3.5.4

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  intl: ^0.20.2
  http: ^1.2.2
  flutter_secure_storage: ^9.2.4
  provider: ^6.1.2
  flutter_launcher_icons: ^0.14.2
  cupertino_icons: ^1.0.8
  flutter_native_splash: ^2.4.4
  animated_text_kit: ^4.2.2
  sign_in_button: ^4.0.1
  google_sign_in: ^7.2.0
  email_validator: ^3.0.0
  flutter_bloc: ^9.1.1
  equatable: ^2.0.7
  app_links: ^6.4.1
  sign_in_with_apple: ^7.0.1
  jwt_decoder: ^2.0.1
  flutter_dotenv: ^6.0.0

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^6.0.0

flutter_native_splash:
  android: true
  ios: true
  color: "#0AA1F2"
  image: "assets/logo_splash.png"
  android_12:
    image: assets/logo_splash.png
    icon_background_color: "#0AA1F2"
    image_dark: assets/logo_splash.png
    icon_background_color_dark: "#0AA1F2"

flutter:
  fonts:
    - family: Coolvetica
      fonts:
        - asset: assets/fonts/coolvetica/Coolvetica-Italic.otf
          style: italic
        - asset: assets/fonts/coolvetica/Coolvetica-Regular-Crammed.otf
          weight: 300
        - asset: assets/fonts/coolvetica/Coolvetica-Regular-Condensed.otf
          weight: 400
        - asset: assets/fonts/coolvetica/Coolvetica-Regular.otf
          weight: 500
        - asset: assets/fonts/coolvetica/Coolvetica-Heavy-Compressed.otf
          weight: 600
  uses-material-design: true
  generate: true
  assets:
    - assets/icon.png
    - assets/icon_nobg.png
    - assets/buttons/apple_icon_x2.png
    - assets/buttons/google_icon_x2.png
    - .env

flutter_launcher_icons:
  android: true
  ios: true
  image_path: "assets/icon.png"
  adaptive_icon_background: "assets/icon.png"
  adaptive_icon_foreground: "assets/icon.png"
2 Likes

I have been running into the exact same issue. I’ve spent 2 nights trying to figure this out, and cannot. Here’s what I’ve tried to no luck.

1. The “Repo Out-of-Date” Error

  • Initial Problem: Error: CocoaPods's specs repository is too out-of-date to satisfy dependencies.

  • What We Did:

    • flutter doctor -v: We ran this first and confirmed your setup (Flutter, Xcode 26.1, CocoaPods 1.16.2) was perfect.

    • “Full Clean”: We ran flutter clean, then in the ios directory, we removed the Podfile.lock and Pods/ folder, cleared the cache with pod cache clean --all, and ran pod install.


2. The Dependency & Config Errors

This fixed the first error but led to new ones.

  • Problem: Generated.xcconfig must exist.

    • Fix: This was a simple order-of-operations issue. We ran flutter pub get in the project root to generate the file before running pod install.
  • Problem: CocoaPods could not find compatible versions for pod "GoogleDataTransport".

    • Diagnosis: This was a major dependency conflict. Your firebase_crashlytics needed a newer version (~> 10.1) while mobile_scanner needed an older version (< 10.0).

    • Fix: flutter pub upgrade didn’t work because a dependency was holding mobile_scanner back. We fixed it by forcing the upgrade from your project’s root folder with flutter pub add mobile_scanner. This got you a new version (7.1.3) that was compatible with Firebase.


3. The Final, Persistent Error: 'Flutter/Flutter.h' file not found

After fixing all dependency issues, pod install finally succeeded, but the project still wouldn’t build.

  • Initial Problem: A generic Command PhaseScriptExecution failed error in the flutter run log.

  • Real Problem: We used Xcode to build and found the true error: fatal error: 'Flutter/Flutter.h' file not found and Unable to find module dependency: 'Flutter'.

  • Diagnosis: This means the main Runner.xcodeproj file is completely failing to find the core Flutter engine framework, which should be provided by CocoaPods.

This is where we’ve tried the most solutions:

  1. The “Nuke and Pave”: We ran pod deintegrate and manually deleted the Pods/, Podfile.lock, and Runner.xcworkspace files to force CocoaPods to rebuild everything from a clean slate.

  2. Manually Checked Build Settings:

    • We searched in Xcode’s “Build Settings” for “Framework Search Paths” and “Other Linker Flags”.

    • We confirmed that $(inherited) was present in both, which is the correct setting to get the paths from CocoaPods.

  3. Synced iOS Versions (The Mismatch):

    • We found a key problem: Your Podfile platform :ios version was set to '12.0', but your Xcode project’s Deployment Target was set to something different.

    • Fix: You updated them to match (both set to 13.0). We then re-ran the “Nuke and Pave” process.

  4. Manually Set Flutter Path:

    • We confirmed your FLUTTER_ROOT variable in “Build Settings” was correct (/opt/homebrew/share/flutter).

    • We then tried to use that variable by adding $(FLUTTER_ROOT)/bin/cache/artifacts/engine/ios directly to your “Framework Search Paths”.

Have you had any luck with this?

does this happen with the default new project too?