27

I've lost the ability to build Flutter applications for iOS since a few days back. I updated my iPad to 11.4 which forced me to update xCode to 9.4 and I think there was a new release of Flutter thrown in the mix too. In my infinite wisdom I updated them all and now can't test my projects any more.

With deadlines approaching quickly I am looking for advice on how to get moving again. I'm not that familiar with Apple products so don't really know my way around xCode etc yet.

This is a fresh 'FLUTTER CREATE testproject' project, no changes have been made to it whatsoever.

FLUTTER RUN log:

Launching lib/main.dart on iPad Pro (12.9-inch) (2nd generation) in debug mode... Starting Xcode build... Xcode build done. Failed to build iOS app Error output from Xcode build: ↳ ** BUILD FAILED ** Xcode's output: ↳ === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug === cp: /Users/trevburley/FlutterSDK/flutter/bin/cache/artifacts/engine/ios/Flutter.framework: No such file or directory find: /Users/trevburley/IdeaProjects/testproject/ios/Flutter/Flutter.framework: No such file or directory Project /Users/trevburley/IdeaProjects/testproject built and packaged successfully. Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure In file included from /Users/trevburley/IdeaProjects/testproject/ios/Runner/GeneratedPluginRegistrant.m:5: /Users/trevburley/IdeaProjects/testproject/ios/Runner/GeneratedPluginRegistrant.h:8:9: fatal error: 'Flutter/Flutter.h' file not found #import <Flutter/Flutter.h> ^~~~~~~~~~~~~~~~~~~ 1 error generated. Could not build the application for the simulator. Error launching application on iPad Pro (12.9-inch) (2nd generation). 

and verbose FLUTTER DOCTOR:

Trevs-MBP:testproject trevburley$ flutter doctor -v [✓] Flutter (Channel beta, v0.4.4, on Mac OS X 10.13.5 17F77, locale en-GB) • Flutter version 0.4.4 at /Users/trevburley/FlutterSDK/flutter • Framework revision f9bb4289e9 (3 weeks ago), 2018-05-11 21:44:54 -0700 • Engine revision 06afdfe54e • Dart version 2.0.0-dev.54.0.flutter-46ab040e58 [✓] Android toolchain - develop for Android devices (Android SDK 27.0.3) • Android SDK at /Users/trevburley/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-27, build-tools 27.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01) • All Android licenses accepted. [✓] iOS toolchain - develop for iOS devices (Xcode 9.4) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 9.4, Build version 9F1027a • ios-deploy 1.9.2 • CocoaPods version 1.5.3 [✓] Android Studio (version 3.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 25.0.1 • Dart plugin version 173.4700 • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01) [✓] IntelliJ IDEA Community Edition (version 2018.1.4) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin version 25.0.2 • Dart plugin version 181.4892.1 [✓] VS Code (version 1.23.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Dart Code extension version 2.13.0 [✓] Connected devices (1 available) • iPad Pro (12.9-inch) (2nd generation) • D8D24435-C465-4403-B74F-E8DD32DDD30A • ios • iOS 11.4 (simulator) • No issues found! 
3
  • No worries - I've been searching for the answer to this all day and finally found a fix that works - 'flutter channel master' followed by 'flutter clean' and 'flutter run' Commented Jun 3, 2018 at 22:22
  • I had same issue few weeks back and I just deleted flutter folder and clone it from same repository and It work for me. Commented Jun 3, 2018 at 23:32
  • If you're facing that issue at a project thats using Firebase, have a look at this answer here at SO Commented Jun 30, 2021 at 8:39

7 Answers 7

59

I guess this problem is caused by interrupting cocoapods install. Here's fix:

  • Remove ios/Flutter/Flutter.framework from your project
  • Run pod install in ios directory. Flutter.framework should be generated, including Headers/Flutter.h file
  • Run build. Everything should be working now

While switching to a different Flutter might work, it doesn't really solves a broken cache problem. Keep in mind that master and beta branches of Flutter are not suitable for production release.

Sign up to request clarification or add additional context in comments.

3 Comments

This solution worked for me (Flutter Channel stable, v1.17.1, on Mac OS X 10.15.3)
In my case, I didn't even have Flutter.framework and I just ran pod install and it worked Thank you very much!
Same for me like @Susca Bogdan :D
20

For Anyone that comes here is 2021

Replace your pod file with this one

platform :ios, '12.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. 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 def flutter_install_ios_plugin_pods(ios_application_path = nil) ios_application_path ||= File.dirname(defined_in_file.realpath) if self.respond_to?(:defined_in_file) raise 'Could not find iOS application path' unless ios_application_path symlink_dir = File.expand_path('.symlinks', ios_application_path) system('rm', '-rf', symlink_dir) # Avoid the complication of dependencies like FileUtils. symlink_plugins_dir = File.expand_path('plugins', symlink_dir) system('mkdir', '-p', symlink_plugins_dir) plugins_file = File.join(ios_application_path, '..', '.flutter-plugins-dependencies') plugin_pods = flutter_parse_plugins_file(plugins_file) plugin_pods.each do |plugin_hash| plugin_name = plugin_hash['name'] plugin_path = plugin_hash['path'] if (plugin_name && plugin_path) symlink = File.join(symlink_plugins_dir, plugin_name) File.symlink(plugin_path, symlink) if plugin_name == 'flutter_ffmpeg' pod 'flutter_ffmpeg/full-lts', :path => File.join('.symlinks', 'plugins', plugin_name, 'ios') else pod plugin_name, :path => File.join('.symlinks', 'plugins', plugin_name, 'ios') end end end end 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 

And Run

flutter pub get cd ios pod install 

EDIT

if it doesn't work then

pod update flutter clean flutter run 

@Credit Latalus

11 Comments

No need to have use_modular_headers!
okay, I just quoted Latalus solution from github
Didn't tried without use_modular_headers!
lol telling people to blanket copy paste replace their entire Podfile ain't it, chief
This one worked for, copying a pod file entirely - good/bad we can always check the code right? so no issues. :-)
|
5

Do this

rm ios/Flutter/Flutter.podspec flutter clean 

then run

flutter pub get 

and

pod install 

2 Comments

"cd ios" before "pod install"
Yes, "cd ios" before "pod install"
2

I've been searching for the answer to this all day and finally found a fix that works, run this in your terminal:

flutter channel master flutter clean flutter run 

I think it was just a flutter bug/incompatibility that hasn't made it out to the main channel yet.

2 Comments

2 years later after this answer, problem still occurs. Do not use Flutter's master channel in production.
master is the bleeding buggy edge dev less so beta more stable stable for public release If beta works, you have a better chance of having more stable code.
1
  1. flutter run [new project] and then replace the iOS folder to the exist project. (you need to backUp your iOS folder of the exist project.)

  2. Replace the ios/Runner from the exist project to the new iOS folder.

  3. Xcode settings same as exist project.

If iOS version problem appear, modify Podfile.

deployment_target = '11.0' post_install do |installer| installer.generated_projects.each do |project| project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = deployment_target end end project.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = deployment_target end end end 
  1. And then, cd ios , pod install.

  2. Flutter run.

Comments

0

I had this problem when I tried to add a share button in my flutter project.

I solve it by following these steps:

  1. Check your pubspec.yaml file.
  2. You should be sure about your pod files and cocoapods. For this, you should follow these steps in terminal: Cannot Install Cocoapods - No podfile found in the project directory

Comments

-5

What worked for me was changing:

#include "Flutter.h" 

to

#include <Flutter/Flutter.h> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.