Flutter is super quick and also updated frequently. Due to its frequent updates, it is possible that you might face issues regarding compatibility. It happens because of its diversified scope and dynamic requirements.
The problem that we will discuss today is the Flutter/Flutter.h file not found error while running Flutter on IOS. We will provide all the workarounds and solutions that can be beneficial for you in fixing this annoying error.
Usually the error Flutter/Flutter.h file not found
occurs when you run the same app that is up and running on Android but you try to run it on IOS. However, some developers might see this error while upgrading from the 1.x flutter version to the 2.x version. This fatal error occurs while running the project on an updated iOS simulator.
It is possible that your PodFile is not picking up the configs so I all you need to do is just change it. An example is given below:
Changing the following code in PodFile
can solve the problem
post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['ENABLE_BITCODE'] = 'NO' config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0' end end end
to
post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) end end
There is a chance where this error occurs when switching from master/dev to beta/stable. You can follow the steps below to solve this error.
Step 1: Remove ios/Flutter/Flutter.podspec
with just one command rm ios/Flutter/Flutter.podspec
Step 2: After removing Flutter.podspec
your flutter will be cleaned.
Step 3: Run your application.
Booom!!!! Your application will run without any issue.
If your problem is still not solved, don’t worry. Here’s the solution 3 for you.
Follow these steps to resolve the problem:
cd ios
to get into the iOS directory of your flutter project.pod deintegrate
rm Flutter/Flutter.podspec
rm podfile.lock
flutter clean
flutter run
If your problem is still not resolved then you need to switch the channel of your app from master to stable. For switching the channel, run following commands in terminal:
flutter channel stable
flutter clean
flutter run
Flutter/Flutter.h file not found
is a known issue among flutter developers. This error is most likely caused when you switch from android to IOS. In some cases it might occur after upgrading flutter version. Regardless of the cause, you can refer all the possible solutions listed in this page to fix the issue.
If you want my team at Chethan Prabhakar to help you build awesome flutter apps, just book a call.