最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Flutter iOS Flutter.h file not found (Build Issue) - Stack Overflow

programmeradmin4浏览0评论

I'm encountering issues building my Flutter project for iOS. Initially, there were some conflicts with Firebase plugins, which I've been troubleshooting without success. I've already tried solutions like reviewing relevant GitHub issues, deleting and regenerating the ios folder and Podfile, and more.

Error:

Error (Xcode): 'Flutter/Flutter.h' file not found
/Users//StudioProjects//ios/Runner/GeneratedPluginRegistrant.h:9:8


Error (Xcode): failed to emit precompiled header '/Users//StudioProjects//ios/DerivedData/Runner/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_P4C6U115X296-clang_1GYDBQ4KC5M9K.pch'
for bridging header '/Users//StudioProjects//ios/Runner/Runner-Bridging-Header.h'


Could not build the application for the simulator.
Error launching application on iPhone 16.

Flutter Doctor:

[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
[✓] Flutter (Channel stable, 3.24.5, on macOS 15.1 24B83 darwin-arm64, locale en-US)

pubspec.yaml:

version: 1.0.0+1

environment:
  sdk: ">=2.17.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  firebase_core: ^3.8.0
  flutter_vector_icons: ^2.0.0
  cupertino_icons: ^1.0.2
  firebase_auth: ^5.3.3
  google_sign_in: ^6.2.1
  firebase_database: ^11.1.6
  firebase_ui_database: ^1.5.0
  flutter_rating_bar: ^4.0.0
  flutter_svg: ^2.0.9
  carousel_slider: ^5.0.0
  google_nav_bar: ^5.0.6
  line_icons: ^2.0.3
  google_fonts: ^5.1.0  # Changed this version
  url_launcher: ^6.3.1
  like_button: ^2.0.5
  animated_bottom_navigation_bar: ^1.3.3
  path_provider: ^2.1.2
  animations: ^2.0.11
  lottie: ^3.1.0
  visibility_detector: ^0.4.0+2
  provider: ^6.1.2
  firebase_phone_auth_handler: ^1.0.8
  dropdown_search: ^5.0.6
  pinput: ^4.0.0
  confetti: ^0.7.0
  firebase_storage: ^12.3.6
  cached_network_image: ^3.3.1
  permission_handler: ^11.3.1
  firebase_messaging: ^15.1.5
  image_picker: ^1.1.1
  firebase_analytics: ^11.3.5
  font_awesome_flutter: ^10.7.0
  flutter_launcher_icons: ^0.13.1
  flutter_screenutil: ^5.9.1
  shimmer: ^3.0.0
  photo_view: ^0.15.0
  flutter_tabler_icons: ^1.29.0
  marquee_text: ^2.5.0+1
  showcaseview: ^3.0.0
  badges: ^3.1.2
  dotted_line: ^3.2.2
  shared_preferences: ^2.2.3
  stories_for_flutter: ^1.2.1
  smooth_page_indicator: ^1.2.0+3
  google_maps_flutter: ^2.9.0
  geolocator: ^12.0.0
  geocoding: ^3.0.0
  webview_flutter_android: any
  webview_flutter_wkwebview: any
  webview_flutter: ^4.8.0
  intl: ^0.19.0
  flutter_image_compress: ^2.3.0
  http: ^1.1.0  

Podfile

platform :ios, '17.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

source '.git'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

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

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)

    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '17.0'

      # Add these specific settings
      config.build_settings['ENABLE_BITCODE'] = 'NO'
      config.build_settings['STRIP_STYLE'] = 'non-global'
      config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'i386'
      config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
      config.build_settings['DEAD_CODE_STRIPPING'] = 'YES'
      config.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] = 'NO'

      # Suppress warnings
      config.build_settings['GCC_WARN_INHIBIT_ALL_WARNINGS'] = 'YES'
      config.build_settings['SWIFT_SUPPRESS_WARNINGS'] = 'YES'
    end
  end
end
发布评论

评论列表(0)

  1. 暂无评论