1

I cannot run or build the iOS app. This always happens with the same error.

  • I have already repaired Flutter pub caches.
  • Deleted the pod files.
  • Removed the iOS folder and tried:
Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running pod install...
Running Xcode build...
Xcode build done.                                           28.2s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    In file included from /Users/ravindu/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/JavaScriptChannelHandler.m:5:
    /Users/ravindu/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/JavaScriptChannelHandler.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    In file included from /Users/ravindu/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/FlutterWebView.m:5:
    /Users/ravindu/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/FlutterWebView.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    In file included from /Users/ravindu/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/FLTWebViewFlutterPlugin.m:5:
    /Users/ravindu/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/FLTWebViewFlutterPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    In file included from /Users/ravindu/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/FLTWKProgressionDelegate.m:5:
    /Users/ravindu/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/FLTWKProgressionDelegate.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    In file included from /Users/ravindu/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/FLTWKNavigationDelegate.m:5:
    /Users/ravindu/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/FLTWKNavigationDelegate.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    In file included from /Users/ravindu/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/FLTCookieManager.m:5:
    /Users/ravindu/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/FLTCookieManager.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete

Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.

Here is the pod file:

# Uncomment this line to define a global platform for your project
 platform :ios, '11.0'

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

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}. Try deleting Generated.xcconfig, then run flutter pub get"
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|
         if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 11.0
           config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
         end
      end
  end
end

Here is the Pubspec.yaml file:

name: fstore
publish_to: "none"
description: Mobile commerce app by Flutter

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 2.8.0+1

environment:
  sdk: ">=2.15.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

  inspireui: 1.0.10

  # Base
  intl: 0.17.0
  crypto: 3.0.1
  path_provider: 2.0.8
  url_launcher: 6.0.17
  localstorage: 4.0.0+1
  http: 0.13.4
  http_auth: 1.0.1
  share: 2.0.4
  wakelock: 0.5.6


  # FIREBASE PACKAGES
  firebase_core: 1.10.5
  firebase_analytics: 9.0.2
  firebase_auth: 3.3.3
  firebase_remote_config: 1.0.2
  firebase_dynamic_links: 4.0.2
  cloud_firestore: 3.1.4

  # STATE MANAGEMENT
  provider: 6.0.1
  get_it: 7.2.0

  # SPLASH SCREEN, ONBOARD
  flare_loading: 3.0.0
  rive: 0.7.33

  # ICON FONTS
  cupertino_icons: 1.0.4

  # WEB TOOLS
  html_unescape: 2.0.0
  webview_flutter: 3.0.0
  webview_flutter_web: 0.1.0
  responsive_builder: 0.4.1
  webview_windows: 0.1.0
  flutter_inappwebview: 5.3.2
  # webview_flutter_wkwebview: ^2.7.1

  # HTML render
  flutter_widget_from_html_core: 0.8.3
  fwfh_text_style: ^2.7.0+1
  fwfh_webview: 0.6.2+1
  fwfh_svg: 0.7.2
  fwfh_cached_network_image: 0.7.0+2
  fwfh_url_launcher: 0.6.1+3
  fwfh_chewie: 0.7.0+1

  # MAP
  google_maps_flutter: 2.1.1
  location: 4.3.0
  maps_launcher: 2.0.1
  geocode: 1.0.1

  # AUTHENTICATION
  the_apple_sign_in: 1.1.1
  flutter_facebook_auth: 3.5.7
  google_sign_in: 5.2.1
  sms_autofill: 2.2.0

  # PUSH NOTIFICATION
  firebase_messaging: 11.2.3
  notification_permissions: 0.6.1
  flutter_local_notifications: 9.1.5
  onesignal_flutter: 3.2.7

  # FILES, IMAGES
  file_picker: 4.2.7
  cached_network_image: 3.2.0
  image: 3.1.0
  transparent_image: 2.0.0
  image_picker: 0.8.4+4
  flutter_native_image: 0.0.6+1
  multi_image_picker2: 5.0.2
  flutter_cache_manager: 3.3.0

  # ADS
  google_mobile_ads: 1.0.1

  # TOOLS
  google_fonts: 2.1.0
  random_string: 2.3.1
  json_annotation: 4.4.0
  timeago: 3.1.0
  universal_platform: 1.0.0+1
  uuid: 3.0.5
  easy_debounce: 2.0.1
  devicelocale: 0.5.0
  collection: 1.15.0
  visibility_detector: 0.2.2
  rate_my_app: 1.1.1+1
  enum_to_string: ^2.0.1
  flutter_linkify: ^5.0.2
  gms_check: ^1.0.0

  # UI
  flutter_spinkit: 5.1.0
  smooth_page_indicator: 1.0.0+2
  animated_text_kit: 4.2.1
  animations: 2.0.2
  flash: 2.0.3
  flutter_staggered_grid_view: 0.4.1
  flutter_swiper_null_safety: 1.0.2
  pull_to_refresh: 2.0.0
  implicitly_animated_reorderable_list: 0.4.2
  rubber: ^1.0.1
  pin_code_fields: 7.3.0
  country_code_picker: 2.0.2
  country_pickers: 2.0.0
  intro_slider: ^3.0.2
  dropdown_search: 2.0.1
  flutter_calendar_carousel: 2.1.0
  currency_text_input_formatter: 2.1.5
  flutter_zoom_drawer: ^2.1.1
  qr_code_scanner: 0.6.1
  paytm_allinonesdk: 1.1.4
  charts_flutter: ^0.12.0

  extended_image:
    git: https://github.com/inspireui/extended_image.git
  razorpay_flutter:
    git: https://github.com/inspireui/razorpay-flutter.git


  ###---- Some extra feature is disable by default -----###
  ### ▶️ Audio Feature
  ### Search "Enable Audio feature" & uncomment to use - https://tppr.me/Z1TX5
  #  audio_manager: ^0.8.1

  ### 🌎 Webview Plugin
  ### Search "Enable webview payment plugin" & uncomment to use - https://tppr.me/wlgV1
  # flutter_webview_plugin: 0.4.0

  ### 💳 Facebook Ads
  ### Search "Enable Facebook Ads" & uncomment to use  - https://tppr.me/9Pkf9
  # facebook_audience_network: 1.0.0-nullsafety.0

dev_dependencies:
  flutter_lints: 1.0.4
  flutter_native_splash: 1.3.2
#  convert_data:
#    path: _dev/convert_data

## Enable to use Flutter Test Driver
#  flutter_driver:
#    sdk: flutter
#  test: 1.16.5
#  dependency_validator: 3.1.0  # pub run dependency_validator

## Enable To run json serializer, run:
## flutter pub run build_runner build --build-filter="lib/models/serializers/*.dart" --delete-conflicting-outputs
## flutter pub run build_runner serve --build-filter="lib/models/serializers/*.dart"
#  build_runner: 2.0.3
#  json_serializable: 4.1.2

#  Run this script to generate the app icon: flutter pub run flutter_launcher_icons:main
flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/images/app_icon.png"

# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
  uses-material-design: true
  assets:
    - lib/config/
    - lib/config/mocks/
    - lib/config/states/
    - lib/config/stories/
    - assets/icons/credit_cards/
    - assets/icons/tabs/
    - assets/icons/payment/
    - assets/icons/logins/
    - assets/images/
    - assets/images/country/
    - assets/images/favicon/
    - assets/html/
    - google_fonts/

flutter_intl:
  enabled: true
  use_deferred_loading: true

I have tried different methods and still same issue.

0

1 Answer 1

1

i have the same issue before a thou days and in mycase the solution was to countinue this steps:

  1. Backup Runner folder
  2. Delete the ios folder
  3. Go to a terminal and execute flutter create . in the flutter project folder
  4. Paste your Runner folder back into the ios folder
  5. pod deintegrate in the ios folder
  6. pod install also in the ios folder
  7. flutter clean in the flutter project folder
  8. flutter pub get
  9. flutter run

Please note that if you use firebase you need to re-insert the GoogleService-Info.plist file

Hope it helps!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.