'error: 'Flutter/Flutter.h' file not found when flutter run on iOS with Flutter 2.10.3 and Xcode 13
I got flutter version updated in my Mac Mini with an Intel Core i5 processor. I also got all dependencies updated and since then, the command flutter build iOS give me the following error message:
Running pod install... 8.5s
Running Xcode build...
Xcode build done. 298.4s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/tg/fczlyhk12rx2w1hmynl87h100000gn/T/flutter_tools.TkBEUj/flutter_ios_bui
ld_temp_dir6kZl5n/temporary_xcresult_bundle
/Users/macmini/development/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handl
er_apple-9.0.3/ios/Classes/strategies/PhonePermissionStrategy.m:50:35: warning:
'subscriberCellularProvider' is deprecated: first deprecated in iOS 12.0
[-Wdeprecated-declarations]
CTCarrier *carrier = [netInfo subscriberCellularProvider];
^~~~~~~~~~~~~~~~~~~~~~~~~~
serviceSubscriberCellularProviders
In module 'CoreTelephony' imported from
/Users/macmini/development/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handl
er_apple-9.0.3/ios/Classes/strategies/PhonePermissionStrategy.m:8:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
iPhoneOS15.2.sdk/System/Library/Frameworks/CoreTelephony.framework/Headers/CTTelephony
NetworkInfo.h:112:50: note: property 'subscriberCellularProvider' is declared
deprecated here
@property(readonly, retain, nullable) CTCarrier *subscriberCellularProvider
API_DEPRECATED_WITH_REPLACEMENT("serviceSubscriberCellularProviders", ios(4.0, 12.0))
API_UNAVAILABLE(macos);
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
iPhoneOS15.2.sdk/System/Library/Frameworks/CoreTelephony.framework/Headers/CTTelephony
NetworkInfo.h:112:50: note: 'subscriberCellularProvider' has been explicitly marked
deprecated here
1 warning generated.
remark: Incremental compilation has been disabled: it is not compatible with whole
module optimization
/Users/macmini/projects/user/plugins/here_sdk/ios/Classes/MapController.swift:14:8:
warning:
'/Users/macmini/projects/user/build/ios/Release-iphoneos/XCFrameworkIntermediates/here
_sdk/heresdk.framework/Modules/heresdk.swiftmodule/Project/arm64-apple-
...
target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported
deployment target versions is 9.0 to 15.2.99. (in target 'gRPC-C++' from project
'Pods')
Result bundle written to path:
/var/folders/tg/fczlyhk12rx2w1hmynl87h100000gn/T/flutter_tools.TkBEUj/flutter_ios_bui
ld_temp_dir6kZl5n/temporary_xcresult_bundle
Error (Xcode): 'Flutter/Flutter.h' file not found
/Users/macmini/projects/user/ios/Runner/GeneratedPluginRegistrant.h:9:8
Error (Xcode): failed to emit precompiled header
'/Users/macmini/Library/Developer/Xcode/DerivedData/Runner-devstpmlflumiphldfeciqbjcala/Bu
ild/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_38Z840ER98F9S-cl
ang_3O4VCJPZ1F0UQ.pch' for bridging header
'/Users/macmini/projects/user/ios/Runner/Runner-Bridging-Header.h'
Encountered error while building for device.
I've tried all the solutions posted for the 'Flutter/Flutter.h' file not found error, but nothing worked.
I have also tried deleting the Pods folder and installing all from scratch, but it didn't work either.
I uninstalled and reinstalled Xcode and the problem is still the same.
Here I leave my flutter doctor, and information on the configuration of my project in flutter.
$ flutter doctor:
[✓] Flutter (Channel stable, 2.10.3, on macOS 12.2.1 21D62 darwin-x64, locale es-419)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] VS Code (version 1.65.0)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
• No issues found!
pubspec.yaml
name: name
description: description
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# 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: 1.0.0+1
version: 7.8.7+7.8.7
environment:
sdk: ">=2.16.1 <3.0.0"
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.4
country_code_picker: ^2.0.2
http: ^0.13.4
firebase_auth: ^3.3.10
firebase_core: ^1.13.1
cloud_firestore: ^3.1.10
intl: ^0.17.0
image_picker: ^0.8.4+11
image_cropper: ^1.5.0
firebase_storage: ^10.2.9
sembast: ^3.2.0
flutter_launcher_icons: ^0.9.2
url_launcher: ^6.0.20
connectivity_plus: ^2.2.1
permission_handler: ^9.2.0
notification_permissions: ^0.6.1
bubble: ^1.2.1
pin_code_fields: ^7.3.0
flutter_rating_bar: ^4.0.0
get: ^4.6.1
cached_network_image: ^3.2.0
here_sdk:
path: plugins/here_sdk
location: ^4.3.0
skeletons: ^0.0.3
firebase_messaging: ^11.2.10
badges: ^2.0.2
dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^1.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/PLASS.png
- assets/main/PlassLogo.png
- assets/main/Artwork.png
- assets/icons/sideMenu.png
- assets/icons/HandUp.png
- assets/icons/currentLocation.png
- assets/icons/pickup.png
- assets/icons/drop.png
- assets/icons/cars/standar.png
- assets/icons/cars/standar-min.png
- assets/icons/cars/standar-min-ios.png
- assets/icons/by-woman.png
- assets/icons/camera.png
- assets/3d/sedan.obj
- assets/3d/plane.obj
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependenc∫ies,
# see https://flutter.dev/custom-fonts/#from-packages
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/main/icon.png"
adaptive_icon_foreground: "assets/main/foreground-icon.png"
adaptive_icon_background: "#ffffff"
Podfile
# Uncomment this line to define a global platform for your project
platform :ios, '12.4'
# 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)
end
end
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
