When I ran the app on iOS 18 (Device - iPhone 13 Mini), It showed the following error.
Flutter/Flutter.h' file not found in file included from /Users/mdsabbirhossain/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.15.0/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/FWFURLHostApi.m:5:
for the package webview_flutter
(webview_flutter_wkwebview
in iOS).
webview_flutter version - 4.9.0 Flutter version - 3.24.3
I have cleared the cache, still have the same result.
rm Podfile.lock
pod cache clear --all
pod deintegrate
flutter clean
flutter pub get
pod install
I have done the process mentioned above.
This is the output of flutter doctor -v
[✓] Flutter (Channel stable, 3.24.3, on macOS 15.0 24A335 darwin-arm64, locale en-BD)
• Flutter version 3.24.3 on channel stable at /Users/mdsabbirhossain/Documents/develop/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2663184aa7 (12 days ago), 2024-09-11 16:27:48 -0500
• Engine revision 36335019a8
• Dart version 3.5.3
• DevTools version 2.37.3
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/mdsabbirhossain/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16A242d
• CocoaPods version 1.15.2
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2022.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
[✓] VS Code (version 1.93.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.96.0
[✓] Connected device (4 available)
• Sabbir’s iPhone (mobile) • 00008020-0005581E1479002E • ios • iOS 17.6.1 21G93
• iPhone 13 mini (mobile) • AA4BA651-0D32-4648-8012-1615DFFD3374 • ios • com.apple.CoreSimulator.SimRuntime.iOS-18-0 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 15.0 24A335 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.0 24A335 darwin-arm64
[✓] Network resources
• All expected network resources are available.
This is the output for flutter run -v
/Users/mdsabbirhossain/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.15.0/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/include/webview_flutter_wkwebview/FWFWebsiteDataStoreHostApi.h
:9:8
[ +1 ms] Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/mdsabbirhossain/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.15.0/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/include/webview_flutter_wkwebview/FWFWebViewHostApi.h:9:8
[ ] Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/mdsabbirhossain/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.15.0/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/include/webview_flutter_wkwebview/FWFWebViewFlutterWKWebViewEx
ternalAPI.h:10:8
[ ] Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/mdsabbirhossain/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.15.0/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/include/webview_flutter_wkwebview/FWFUserContentControllerHost
Api.h:9:8
[ ] Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/mdsabbirhossain/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.15.0/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/include/webview_flutter_wkwebview/FWFWebViewConfigurationHostA
pi.h:9:8
[ ] Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/mdsabbirhossain/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.15.0/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/include/webview_flutter_wkwebview/FWFURLProtectionSpaceHostApi
.h:11:8
[ ] Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/mdsabbirhossain/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.15.0/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/include/webview_flutter_wkwebview/FWFURLHostApi.h:9:8
[ ] Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/mdsabbirhossain/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.15.0/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/include/webview_flutter_wkwebview/FWFURLCredentialHostApi.h:12
:8
[ +1 ms] Could not build the application for the simulator.
[ ] Error launching application on iPhone 13 mini.
[ +1 ms] "flutter run" took 27,702ms.
[ +1 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:874:9)
<asynchronous suspension>
#2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1408: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:420: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:130: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:93:3)
<asynchronous suspension>
[ +174 ms] ensureAnalyticsSent: 173ms
[ ] Running 2 shutdown hooks
[ +1 ms] Shutdown hooks complete
[ ] exiting with code 1
I managed to resolve the issue by removing the Flutter framework from the Xcode project. When Xcode and Flutter are upgraded, there can be key mismatches with the Flutter framework. By removing the framework, it will be installed as a new one, resolving the key mismatch. To remove the Flutter framework, follow these steps:
To remove the Flutter framework do the following:
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
After removing the framework, do the following process.
rm -rf ~/Library/Developer/Xcode/DerivedData
rm Podfile.lock
pod cache clear --all
pod deintegrate
flutter clean
flutter pub get
pod install
If you are using Firebase packages, don't forget to the following in Xcode:
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES
. Make the value of CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES
to YES
.ENABLE_BITCODE
value. It must be set to true
.Lastly, change your Podfile to the following:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end