Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter/Flutter.h' file not found #70

Open
bluemoon-i opened this issue Aug 27, 2024 · 1 comment
Open

Flutter/Flutter.h' file not found #70

bluemoon-i opened this issue Aug 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@bluemoon-i
Copy link

bluemoon-i commented Aug 27, 2024

I tried running the example on a physical iOS device and received the error:

Launching lib/main.dart on WJ的iPhone 4S in debug mode...
Developer identity "Apple Development: PENG LUO (B6FLSVS2UL)" selected for iOS code signing
Running Xcode build...
Xcode build done.                                           21.8s
Failed to build iOS app
Could not build the precompiled application for the device.
Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/mac/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter_wkwebview-3.15.0/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/include/webview_flutter_wkwebview/FWFWebsiteDataStoreHostApi.h:9:8

Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/mac/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter_wkwebview-3.15.0/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/include/webview_flutter_wkwebview/FWFWebViewConfigurationHostApi.h:9:8

Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/mac/.pub-cache/hosted/pub.flutter-io.cn/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/mac/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter_wkwebview-3.15.0/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/include/webview_flutter_wkwebview/FWFUserContentControllerHostApi.h:9:8

Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/mac/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter_wkwebview-3.15.0/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/include/webview_flutter_wkwebview/FWFWebViewFlutterWKWebViewExternalAPI.h:10:8

Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/mac/.pub-cache/hosted/pub.flutter-io.cn/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/mac/.pub-cache/hosted/pub.flutter-io.cn/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/mac/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter_wkwebview-3.15.0/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/include/webview_flutter_wkwebview/FWFURLCredentialHostApi.h:12:8


Error launching application on WJ的iPhone 4S.
@bluemoon-i bluemoon-i added the bug Something isn't working label Aug 27, 2024
@omairtahir21
Copy link

The error you're encountering, 'Flutter/Flutter.h' file not found, typically indicates an issue with the Flutter framework not being correctly linked in your iOS project. Here are steps you can follow to resolve this issue:

1. Clean and Rebuild the Project
Run the following commands in your terminal:

flutter clean
flutter pub get

After cleaning, rebuild the project:
flutter build ios
2. Check Flutter SDK Path
Ensure that the Flutter SDK is correctly set up and that the path is correctly configured. You can verify this by running:
flutter doctor
If any issues are reported, follow the instructions to resolve them.

3. Update CocoaPods
Ensure that CocoaPods is up to date and has installed the necessary dependencies:

sudo gem install cocoapods
cd ios
pod install

If you're facing issues with CocoaPods, try running:

pod repo update
pod install --repo-update

4. Modify Podfile
Open your ios/Podfile and make sure it includes the following lines:
platform :ios, '10.0' # or the minimum version required by your app

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

  # Add this line if not present
  pod 'webview_flutter_wkwebview', :path => File.join('.symlinks', 'plugins', 'webview_flutter_wkwebview', 'ios')
end

After modifying the Podfile, run pod install again.

5. Ensure Xcode Settings
Open your project in Xcode by running:
open ios/Runner.xcworkspace
Go to File > Workspace Settings and ensure the build system is set to New Build System (default).

Under Runner > Build Settings > Search Paths, make sure Framework Search Paths is set to $(inherited) and points to the correct location of your Flutter SDK.

6. Check Bridging Header
Ensure that the Runner-Bridging-Header.h file includes the following import:
#import "Flutter/Flutter.h"
7. Rebuild in Xcode
Try building the project directly in Xcode to catch any detailed errors:

Select your physical device from the list of devices.
Press Cmd+B to build the project.
8. Reboot Xcode
Sometimes, simply restarting Xcode can resolve issues due to cache or other temporary problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

6 participants
@bluemoon-i @omairtahir21 and others