tekartik / sqflite

SQLite flutter plugin
BSD 2-Clause "Simplified" License
2.88k stars 527 forks source link

'FlutterMacOS/FlutterMacOS.h' file not found #1027

Open almogtovim opened 1 year ago

almogtovim commented 1 year ago

Description: I am encountering issues with sqflite on the macOS platform since upgrading to Xcode 13. Whenever I run my Flutter app, I receive the following error message:

` In file included from /Users/almogtovim/.pub-cache/hosted/pub.dev/sqflite-2.2.8+4/macos/Classes/SqfliteDatabase.m:1: In file included from /Users/almogtovim/.pub-cache/hosted/pub.dev/sqflite-2.2.8+4/macos/Classes/SqfliteDatabase.h:11: In file included from /Users/almogtovim/.pub-cache/hosted/pub.dev/sqflite-2.2.8+4/macos/Classes/SqfliteOperation.h:10: /Users/almogtovim/.pub-cache/hosted/pub.dev/sqflite-2.2.8+4/macos/Classes/SqfliteImport.h:13:9: fatal error: 'FlutterMacOS/FlutterMacOS.h' file not found

import <FlutterMacOS/FlutterMacOS.h>

    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1 error generated. `

Attempted Solutions: I have already tried the following troubleshooting steps, but the error persists:

Deleted the macos folder and regenerated it again using flutter create . Added platform :osx, '11.0' to the Podfile. Ran pod deintegrate, flutter clean, flutter pub get, and pod install commands.

Here is the output of flutter doctor -v (hidden within a GitHub dropdown):

flutter doctor -v output

` [✓] Flutter (Channel stable, 3.10.5, on macOS 13.4 22F66 darwin-arm64, locale en-IL) • Flutter version 3.10.5 on channel stable at /Users/almogtovim/Development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 796c8ef792 (2 weeks ago), 2023-06-13 15:51:02 -0700 • Engine revision 45f6e00911 • Dart version 3.0.5 • DevTools version 2.23.1 [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at /Users/almogtovim/Library/Android/sdk • Platform android-33, build-tools 33.0.0 • ANDROID_HOME = /Users/almogtovim/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14E300c • CocoaPods version 1.12.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.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 11.0.13+0-b1751.21-8125866) [✓] VS Code (version 1.79.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.66.0 [✓] Connected device (2 available) • macOS (desktop) • macos • darwin-arm64 • macOS 13.4 22F66 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 114.0.5735.198 [✓] Network resources • All expected network resources are available. • No issues found! `

lucasjinreal commented 1 year ago

Same error

luohao123 commented 1 year ago

@almogtovim Did u solve it/?

filiphosko commented 1 year ago

Having the same issue, channel stable 3.13.4, on macOS 13.5.2 22G91 darwin-arm64, XCode 15.0.

aykutucar commented 1 year ago

Same issue with Flutter 3.13.5, macOS 13.5.2, XCode 15.0.

timobaehr commented 1 year ago

Same issue with Flutter 3.13.2, macOS 13.4.1, XCode 14.3.1

Related to https://github.com/flutter/flutter/issues/134855.

hushmand commented 1 year ago

same issue

alextekartik commented 1 year ago

Are you able to reproduce this issue with a newly created xcode project file ? Sometimes I re-generate it. If you try the following in the example folder:

flutter create --platform macos .
flutter run -d macos

does it work for you ? Side note: after installing XCode 15.0, I had to accept the license first:

sudo xcodebuild -license

as reported the first time I ran flutter run.

aykutucar commented 1 year ago

Thanks @alextekartik, I created a new project and moved the code into that and it works fine.

KerJen commented 1 year ago

Just check that your post_install section in Podfile of macos folder looks like

post_install do |installer|
  installer.pods_project.targets.each do |target|
     flutter_additional_macos_build_settings(target)
  end
end

cause my problem was with line flutter_additional_macos_build_settings(target) and it was flutter_additional_ios_build_settings(target), I just copied a quick fix for Xcode 15 from other mobile flutter project

Also I set 10.14 version in platform :osx, '10.14'

aykutucar commented 1 year ago

@KerJen, your solution was more practical. It also worked in my original project. Thanks so much.

SanDyLibs commented 8 months ago

Great Job..!! @KerJen

kavya-tayall commented 1 week ago

Just check that your post_install section in Podfile of macos folder looks like

post_install do |installer|
  installer.pods_project.targets.each do |target|
     flutter_additional_macos_build_settings(target)
  end
end

cause my problem was with line flutter_additional_macos_build_settings(target) and it was flutter_additional_ios_build_settings(target), I just copied a quick fix for Xcode 15 from other mobile flutter project

Also I set 10.14 version in platform :osx, '10.14'

Good Job, My error also fixed.