skip to Main Content

I’m encountering a "Flutter.h not found" error when trying to build my Flutter app in Xcode. This error is causing an issue in my PluginRegistrant file, and I’ve tried several potential solutions – like reinstalling pod files, updating dependencies, and creating a new project – but nothing seems to be working.

It seems like my project is unable to access the Flutter framework, even though my certificates are valid in the keychain. I’ve made some changes to the podfile in the Pods directory, but that didn’t help either.

At this point, I’m not sure what else to do. If you have any suggestions, I’d really appreciate it.

Sometimes its the sqflite, geolocator or permission handler. There are always some packages that are unable to access Flutter.

enter image description here

2

Answers


  1. This error can occur when the Flutter/Flutter.h file is not found in your Xcode project. Here are some steps you can take to resolve the issue:

    1. Make sure you have the latest version of Flutter and the PermissionHandlerPlugin. You can run flutter pub upgrade in your project directory to upgrade your packages.

    2. Open your Xcode project and navigate to the "Runner" project.

    3. Select "Build Settings" and search for "Header Search Paths".

    4. Add the following path to your Header Search Paths:

      $(FLUTTER_FRAMEWORK_DIR)/Headers
      

      This path will tell Xcode where to find the Flutter/Flutter.h file.

    5. Clean your Xcode project by going to "Product" > "Clean Build Folder".

    6. Rebuild your Xcode project by going to "Product" > "Build".

    If you still encounter the error, try deleting the Podfile.lock file and running flutter clean in your project directory, then reinstalling the pod dependencies by running flutter run.

    Or, Check out this issue reported on GitHub, it might help: Link

    Login or Signup to reply.
  2. i trying many thing then I found a solution!

    1.Backup ios/Runner folder.

    2.Delete the ios folder.

    3.Run flutter create (your project name). in the previous folder where you have your project(cd users/user/"projects_folder") (this will recreate your ios folder).

    4.Paste your Runner backup in the ios folder (into the project).

    5.Open Runner.xcworkspace (into ios folder) and there, check the Version, the Bundle ID, all the info.

    (If do you Have Firebase, you have to copy and paste again the Google Service-Info.Plist into the Runner folder (Always through Xcode) (If do you do this manually, it doesn’t work).

    Finally, flutter run and should work!

    If flutter run fails:

    cd ios

    pod install

    cd ..

    flutter run

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search