I'm currently facing a recurring issue while attempting to build my Flutter app for the iOS simulator. The build process fails with the following error
Error (Xcode): Framework 'Flutter' not found Error (Xcode): Linker command failed with exit code 1
Steps I've Taken:
Recreated the ios/ folder and cleared derived data: Used flutter clean to clean the project. Reinstalled CocoaPods with pod deintegrate followed by pod install. Verified Configuration: Checked AppDelegate and framework paths within Xcode. Set the deployment target to 14.0 in the Podfile. Additional Actions: Performed flutter clean again, followed by removal of Pods, .symlinks, and Flutter.framework under ios/. Updated CocoaPods, ensured all dependencies in pubspec.yaml are current. Added FirebaseCore initialization in AppDelegate.swift to resolve previous Firebase integration issues.
Despite these efforts, the "Framework 'Flutter' not found" error persists. Here's the relevant part of my AppDelegate.swift and Podfile:
swift import Flutter import UIKit
@main @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } }
ruby platform :ios, '14.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))
target 'RunnerTests' do inherit! :search_paths end end
post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(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") end end end
Error Log from Flutter Run:
[ +278 ms] Failed to build iOS app [ +42 ms] Error (Xcode): Framework 'Flutter' not found
[ +8 ms] Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)
[ +7 ms] Could not build the application for the simulator. [ +1 ms] Error launching application on iPhone 16 Pro Max. [ +6 ms] "flutter run" took 88,663ms. [ +164 ms] #0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3) #1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:860:9) <asynchronous suspension> #2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1450:27) <asynchronous suspension> #3 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19) <asynchronous suspension> #4 CommandRunner.runCommand (package:args/command_runner.dart:212:13) <asynchronous suspension> #5 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:421:9) <asynchronous suspension> #6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19) <asynchronous suspension> #7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:364:5) <asynchronous suspension> #8 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:131:9) <asynchronous suspension> #9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19) <asynchronous suspension> #10 main (package:flutter_tools/executable.dart:94:3) <asynchronous suspension>. Environment:
Flutter: Version 3.27.3, Channel stable Xcode: Version 16.2, Build 16C5032a CocoaPods: Version 1.16.2 macOS: Version 15.2 (24C101)
Additional Context:
Initially, the issue was resolved by the sequence of cleanup and reinstalls listed above, but it re-emerged after integrating Firebase authentication. After adding FirebaseCore to AppDelegate.swift, the Firebase issue was resolved, but the framework error returned.
I'm seeking guidance to resolve this issue permanently. Any insights or suggestions would be greatly appreciated!