1

What I am doing now is an iOS project, I have connected to flutter, and it was running normally before 3.0.3. Because I used Matrix4.setEntry when I was doing animation, there was a freeze after a period of continuous operation. I found an answer in issues that required me to upgrade to above 3.3.0. But after I upgraded to 3.3.8, the 'Flutter/Flutter.h' file was not found appeared.

flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.8, on macOS 12.6 21G115 darwin-x64, locale
    zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2.4)
[✓] VS Code (version 1.71.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
• No issues found!

After I upgraded to 3.3.8, I found that Pods/Development pods/Flutter no longer has a Frameworks directory. I found a useful information in Flutter.podspec:

Pod::Spec.new do |s|
    s.name             = 'Flutter'
    s.version          = '1.0.0'
    s.summary          = 'A UI toolkit for beautiful and fast apps.'
    s.homepage         = 'https://flutter.dev'
    s.license          = { :type => 'BSD' }
    s.author           = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
    s.source           = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
    s.ios.deployment_target = '11.0'
    # Framework linking is handled by Flutter tooling, not CocoaPods.
    # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs.
    s.vendored_frameworks = 'path/to/nothing'
end

I still can't understand: Framework linking is handled by Flutter tooling, not CocoaPods. Do I need to execute any commands? Or just compile the main project. But at present, this problem will appear as long as the project is compiled: the 'Flutter/Flutter.h' file was not found.

I also noticed that there is a description of Flutter.framework in podhelper.rb, but I don't know if it helps me.

def install_flutter_application_pod(flutter_application_path)
  flutter_application_path ||= File.join('..', '..')

  export_script_directory = File.join(flutter_application_path, '.ios', 'Flutter')

  # Keep script phase paths relative so they can be checked into source control.
  relative = flutter_relative_path_from_podfile(export_script_directory)

  flutter_export_environment_path = File.join('${SRCROOT}', relative, 'flutter_export_environment.sh');

  # Compile App.framework and move it and Flutter.framework to "BUILT_PRODUCTS_DIR"
  script_phase :name => 'Run Flutter Build vbf_module Script',
    :script => "set -e\nset -u\nsource \"#{flutter_export_environment_path}\"\nexport VERBOSE_SCRIPT_LOGGING=1 && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/xcode_backend.sh build",
    :execution_position => :before_compile

  # Embed App.framework AND Flutter.framework.
  script_phase :name => 'Embed Flutter Build vbf_module Script',
    :script => "set -e\nset -u\nsource \"#{flutter_export_environment_path}\"\nexport VERBOSE_SCRIPT_LOGGING=1 && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/xcode_backend.sh embed_and_thin",
    :execution_position => :after_compile
end

I don't know if I understand correctly, the timing of Flutter.framework embedding is too late for me. At least the Embed Flutter Build vbf_module Script has not been executed before compiling the error.

Special attention: I have tried all the clean methods, and I can be sure that it is not caused by the cache, nor is it caused by cocoapods. I downgraded to 3.0.3 and it works.

Nullable
  • 761
  • 5
  • 17

1 Answers1

0

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.

  6. (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