"Flutter/Flutter.h not found." on iOS.
Problem
Steps to Reproduce Preface: I'm on the flutter `master` channel and have run `upgrade` half an hour ago. I've reinstalled flutter and cocoapods completely before and tried the fixes provided in #15437, #15532 and all other issues on GitHub looking like the problem I have. _ `flutter create --template=plugin -i swift health_stats` `cd health_stats/example` health_stats.zip Logs _Run your application with `flutter run` and attach all the log output._ [code block] _Run `flutter analyze` and attach any output of that command also._ [code block] Flutter Doctor _Paste the output of running `flutter doctor -v` here._ [code block] Additional information Creating and running a normal project works fine: `flutter create regular` `cd regular` `flutter run` [code block] However when adding a dependency like `path_provider`: [code block] and then `flutter packages get`, [code block] `flutter run` produces this: [code block] I did not have `path_provider` version `0.4.0` in my dart packages folder before running the app, so it's a fresh copy. I need to get this working a.s.a.p. since I need to make an app for our company soon.
Error Output
Error output from Xcode build:
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Resolve 'Flutter/Flutter.h not found' Error on iOS
The error 'Flutter/Flutter.h not found' typically occurs when the Flutter framework is not correctly linked in the Xcode project settings. This can happen due to issues with CocoaPods not installing the Flutter dependencies properly or the project not being configured to find the Flutter framework.
Awaiting Verification
Be the first to verify this fix
- 1
Ensure CocoaPods is Installed and Updated
Make sure that CocoaPods is installed and updated to the latest version. This is crucial for managing iOS dependencies.
bashsudo gem install cocoapods pod setup - 2
Clean Flutter Project
Run the following command to clean the Flutter project and remove any cached build artifacts that might be causing issues.
bashflutter clean - 3
Reinstall iOS Dependencies
Navigate to the iOS directory of your Flutter project and reinstall the CocoaPods dependencies to ensure they are correctly set up.
bashcd ios pod install - 4
Check Xcode Build Settings
Open the project in Xcode and ensure that the 'Framework Search Paths' includes the path to the Flutter framework. This is usually set to '$(inherited)' and should point to the correct Flutter SDK path.
plaintextOpen Xcode > Select your project > Build Settings > Framework Search Paths - 5
Run the Application
After completing the previous steps, attempt to run your application again using Flutter to verify that the issue is resolved.
bashflutter run
Validation
Confirm that the application runs without the 'Flutter/Flutter.h not found' error. Check the console output for any additional errors and ensure that the app builds successfully in both Flutter and Xcode.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep