drydart / model_viewer.dart

A Flutter widget for rendering interactive 3D models in the glTF and GLB formats.
https://pub.dev/packages/model_viewer
The Unlicense
209 stars 101 forks source link

Flutter/Flutter.h' file not found #70

Open bluemoon-i opened 2 weeks ago

bluemoon-i commented 2 weeks ago

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.
omairtahir21 commented 2 weeks ago

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.