flutter build ipa - Command PhaseScriptExecution failed with a nonzero exit code - ios

I am using flutter and trying to build an ipa file, I am able to run my app my device or simulator no problem, but can't build an ipa file. I am using the flutter command flutter build ipa and I get this error:
Command PhaseScriptExecution failed with a nonzero exit code
I have tried to do the following:
flutter clean
flutter pub get
cd ios
pod install
pod update
Here is my Podfile:
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__))
pod 'DKImagePickerController/PhotoGallery', :git => 'https://github.com/miguelpruivo/DKImagePickerController.git'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
And here is my pubspec.yaml file:
name: myApp
description: An app for parents built by parents
version: 1.0.0+1
environment:
sdk: ">=2.15.1 <3.0.0"
dependencies:
flutter:
sdk: flutter
firebase_core: 1.12.0
firebase_auth: 3.3.6
cloud_firestore: 3.1.7
firebase_messaging: 11.2.6
firebase_database: 9.0.6
firebase_storage: 10.2.6
shared_preferences: 2.0.12
json_annotation: 4.4.0
uuid: 3.0.5
flutter_easyloading: 3.0.3
flutter_svg: 1.0.3
adaptive_dialog: 1.3.0
image_picker: 0.8.4+5
charts_flutter: 0.12.0
url_launcher: 6.0.12
dart_date: 1.1.1
carousel_slider: 4.0.0
dots_indicator: 2.1.0
open_mail_app: 0.4.4
percent_indicator: 4.0.0
audioplayers: 0.20.1
number_picker_dialog: 0.0.1
share_plus: 3.1.0
flutter_tabler_icons: 1.1.1
flutter_local_notifications: 9.4.0
intl: 0.17.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: 1.0.0
build_runner: 2.1.7
json_serializable: 6.1.4
flutter_icons:
android: "launcher_icon"
ios: true
remove_alpha_ios: true
image_path: "assets/icons/logo.png"
flutter_launcher_name:
name: "MyApp"
flutter:
uses-material-design: true
assets:
- assets/images/intro/
- assets/images/questions/
- assets/images/badges/
- assets/icons/
- assets/data/
- assets/audio/
fonts:
- family: Chalkboard
fonts:
- asset: assets/fonts/chalkboard/Daneehand Demo.otf
- family: Poppins-Light
fonts:
- asset: assets/fonts/poppins/Poppins-Light.ttf
- family: Poppins-Regular
fonts:
- asset: assets/fonts/poppins/Poppins-Regular.ttf
- family: Poppins-Medium
fonts:
- asset: assets/fonts/poppins/Poppins-Medium.ttf
- family: Poppins-SemiBold
fonts:
- asset: assets/fonts/poppins/Poppins-SemiBold.ttf
- family: Poppins-Bold
fonts:
- asset: assets/fonts/poppins/Poppins-Bold.ttf
Can anyone tell me what I am doing wrong?

Update your SDK version from flutter upgrade version 3.0.2 to 3.0.3.
export PATH="your_path/flutter/bin:$PATH"
flutter clean
flutter pub get
cd ios
sudo gem pod install
pod install
run the app from Android Studio IDE so that it checks all the necessary installs.
flutter build ipa --release -t lib/main.dart
Hope it may help you.

You can check the below steps:
Go to iOs Folder and delete podlock file and pods folder
Go to the pod file and edit the below section that contains like as below pic:
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'] = '13.0'
end
end
end
Go to terminal and cd to iOS folder and run "pod cache clean --all" command
run pod install(pod update) command
Try to Archive again with XCode IDE

First clear Derived data from preference and remove it from bin as well
flutter clean
flutter pub get
cd ios
pod install
pod update
Try this

I was exactly same problem,
Finally I found out after spending two days.
In my case.
Just flutter upgrade version 3.0.2 to 3.0.3

I usually have this problem when a dependency is not updated.
You can try following these steps, this usually works for me:
1- Delete your Podfile.lock (I like to use the command 'rm -rf Podfile.lock' on the terminal for this)
2- Delete your Pods folder (I like to use the command 'rm -rf Pods' in the terminal for this)
3- Delete your .xcworkspace
4- Pod install
5- Clear your project into XCode> Product> Clean Build Folder

This mainly happens because of less space in your machine. Clean up some space, delete derived data and archieves of older builds
Path to derived data
~/Library/Developer/Xcode/DerivedData
Enter this in finder -> go -> go to folder
Yoy can also restart your machine to clean all temp files
Also try building it from xcode directly

Related

How do i resolve these depreciation errors during xcode build?

I've built my podfile using flutter and the following depreciations are shown for android 12. I tried pod install and pod outdated returns all as up to date. There are no build errors and i can deploy the application successfully but i want to resolve these depreciation warnings and semantic issues as well. All ios deployment targets are set to 12.0. tried flutter clean, pod deintegrate.
pubspec.yaml file packages:
description: A new Flutter project.
https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.12.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
webview_flutter: ^3.0.4
flutter_secure_storage: ^5.0.2
shared_preferences: ^2.0.15
intl: 0.17.0
url_launcher: ^6.1.5
http: ^0.13.4
rxdart: ^0.27.5
provider: ^6.0.3
awesome_dialog: ^2.2.1
jwt_decoder: 2.0.1
country_code_picker: 2.0.2
flutter_local_notifications: ^9.7.0
permission_handler: ^10.0.0
firebase_core: ^1.19.2
firebase_messaging: ^12.0.0
shimmer: 2.0.0
flutter_typeahead: ^4.0.0
cached_network_image: ^3.2.1
flutter_html: ^3.0.0-alpha.5
flutter_staggered_animations: 1.0.0
file_picker: ^4.6.1
csv: ^5.0.1
path_provider: ^2.0.11
flutter_rating_bar: ^4.0.1
image_picker: ^0.8.5+3
photo_view: ^0.14.0
flutter_downloader: ^1.8.1
image_downloader: ^0.31.0
flutter_math_fork: ^0.6.3+1
dev_dependencies:
flutter_test:
sdk: flutter
Podfile:
platform :ios, '12.0'
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
Most of these warnings usually come from packages you use in your project. If these are only warnings, ignore them because they are out of your control but if there are errors, either report to package author or fix the error yourself by forking the repository.
In xcode open the xcworkspace file. Then in product select clean build folder.. then on the top area you will see a warning symbol. On clicking that the left panel should show an warnings to upgrade package..click on that and a pop up will appear with option to update. All the other warnings during build can be ignored.

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

Could not build the iOS app Flutter - 'Flutter/Flutter.h' file not found

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.
i have the same issue before a thou days and in mycase the solution was to countinue this steps:
Backup Runner folder
Delete the ios folder
Go to a terminal and execute flutter create . in the flutter project folder
Paste your Runner folder back into the ios folder
pod deintegrate in the ios folder
pod install also in the ios folder
flutter clean in the flutter project folder
flutter pub get
flutter run
Please note that if you use firebase you need to re-insert the GoogleService-Info.plist file
Hope it helps!

Searching for inspections failed: undefined method `map' for nil: NilClass in Flutter Application

I am working on the Flutter application which is based on a simple Chat. I am using Firebase Auth, Firebase Messaging, Google Sign in, and Cloud Firestore. Everything is working smoothly in Android but when I run this application in an iOS environment, I am facing some issues like,
" Error output from CocoaPods:
↳
Searching for inspections failed: undefined method `map' for nil: NilClass
Exception: Error running pod install "
I have also installed a cocoapod but it was not working properly, that time I also face another issue which is mention below:-
" Don't forget to anonymize any private data!
Looking for related issues on cocoapods/cocoapods...
Searching for inspections failed: undefined method `map' for nil: NilClass "
I had also used some solution which is a reference on Github but still, those thing is not working.
============== References:-
https://github.com/CocoaPods/CocoaPods/issues/8425
https://github.com/flutter/flutter/issues/75961
================ This is my Flutter Doctor response:-
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.6, on macOS 11.0.1 20B50 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] Connected device (2 available)
• No issues found!
=================== This is my pubspec.yaml:-
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
**google_sign_in: 4.4.3**
**firebase_auth: 0.15.4**
**cloud_firestore: ^0.13.5**
shared_preferences: ^0.5.6+3
**firebase_messaging: 6.0.13**
flutter_local_notifications:
http: ^0.12.2
==================== This is my cocoapods enviornment and also pod file
Stack
CocoaPods : 1.10.1
Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
RubyGems : 3.1.4
Host : macOS 11.0.1 (20B50)
Xcode : 12.2 (12B45b)
Git : git version 2.23.0
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/
Installation Source
Executable Path: /usr/local/bin/pod
Plugins
cocoapods-deintegrate : 1.0.4
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-trunk : 1.5.0
cocoapods-try : 1.2.0
Podfile
# Uncomment this line to define a global platform for your project
platform :ios, '9.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)
end
end
In this podfile, I have removed pods because of occurring some issues which I mentioned above.
I am working with the macOS Big Sur version - 11.0.1 for development in Android Studio version 4.1 and Testing that application in iPad(6th generation) version 14.2.
Can anyone please assist me with what I am doing wrong? so further I can able to resolve this error in iOS.
Thank you in advance.
As I see that the comment section is getting bigger, I'll follow up here.
I see in the drive link that there is some problems with the .xcodeproj file, could you attach it too to the drive?
In some cases the default pods installation is wrong and it needs to manually edit the .xcodeproj file to remove the sections causing the problem.
In some cases, after running gem update xcodeproj solves the issue.
In addition, it would be nice if you use the latest CocoaPod version, as maybe there is some compatibility issues between Xcode version and CocoaPod version.

Flutter Podfile and Pods folders not created in ios directory

Created a new flutter project from Android Studio using the wizard.
Newly created project folder does not have any of the Pods folders or podfile in the ios directory.
This Flutter.io page states (emphasis mine):
While there is a Podfile in the iOS folder in your Flutter project,
only use this if you are adding native dependencies needed for
per-platform integration.
There is no podfile at all in my ios directory.
I found this comment in a different question here suggesting running the project on the ios simulator would generate the file but running the project on the sim and device both do not result in any podfile creation for me.
Is there some step in the ios side of the new flutter project creation that I missed? There's no way for me to add ios-specific dependencies without the podfile.
Output of flutter doctor:
[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.12.6 16G1408, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
[✓] Android Studio (version 3.1)
[!] VS Code (version 1.25.1)
[✓] Connected devices (1 available)
Here is what I usually do:
go into ios folder
delete the Podfile.lock file
rm -rf Pods
pod cache clean --all
pod deintegrate
pod setup
pod install
You may also want to do
pod repo update
Once you run flutter build ios a Podfile and Podfile.lock will be created for you in the ios directory.
Follow the steps in the deploy steps official documentation.
I will suggest simply go to your Flutter Package and do flutter create .
It will automatically create all the missing files and even Podfile.
I have used this command in my project and it is fruitful.
Recently, I encountered the same problem. No Podfile created even when I add dependency packages in the pubspec.yaml file. In the end, I have to manually add a Pod file in the ios directory and issue 'pod deintegrate', 'pod setup' and 'pod install'.
Here is my podfile. You can try it:
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
pod 'Firebase/Core'
pod 'FBSDKLoginKit' #optional
pod 'GoogleAnalytics'
def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
pods_ary = []
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) { |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
pods_ary.push({:name => podname, :path => podpath});
else
puts "Invalid plugin specification: #{line}"
end
}
return pods_ary
end
target 'Runner' do
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
use_frameworks!
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
# Flutter Pods
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
end
generated_xcode_build_settings.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
symlink = File.join('.symlinks', 'flutter')
File.symlink(File.dirname(p[:path]), symlink)
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
end
}
# Plugin Pods
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.map { |p|
symlink = File.join('.symlinks', 'plugins', p[:name])
File.symlink(p[:path], symlink)
pod p[:name], :path => File.join(symlink, 'ios')
}
end
#pre_install do |installer|
# workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
# Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
#end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['SWIFT_VERSION'] = '4.2'
end
# Peter aded on 8 Oct 2018
# workaround for https://github.com/CocoaPods/CocoaPods/issues/7463
#target.headers_build_phase.files.each do |file|
# file.settings = { 'ATTRIBUTES' => ['Public'] }
#end
end
end
Also, I tried using Vcode to create a new Flutter project. Add package in pubspec.yaml file, save and the podfile was automatically created,
Create a new Flutter project using Vcode
Start VS Code
Invoke View>Command Palette…
Type ‘flutter’, and select the ‘Flutter: New Project’ action
Enter a project name (e.g. myapp), and press Enter
Specify a location to place the project, and press the blue OK
button
Wait for the project creation to continue, and the main.dart file to
appear
Add a package in the pubspec.yaml file and save it.
The podfile should be created.
flutter:
plugin:
platforms:
ios:
pluginClass: AppDelegate
You need to add the above lines to the pubspec.yaml and then the pub would automatically generate the Podfile inside the ios folder.
[Windows/Android studio] To create podfile all you need is to run pod init in ios folder in your flutter project, If you are using window and not yet installed CocoPods, then you need to install ruby which is prerequires to install CocoPods (pod command) which in turn is used to create podfile
Once they are installed, navigate to ios folder in your flutter project and run the following command to create init podfile in ios folder:
pod init
For me the reason the podfile in the ios folder was not being created was the fact that I had made it a module in the pubspec:
module:
androidX: true
androidPackage: ******
iosBundleIdentifier: ******
Removing this part from the pubspec made flutter generate the podfile again when running pub get. I'm using it as a module but like to be able to run the project standalone as well, so for that reason I put the module bit back in again after running a pub get.
I had just created a new project and didn't see the Podfile in the ios/ directory. I needed the Podfile in order to setup Firebase integration. Although it has been pointed out in a comment by #ncuillery, I thought I should add an answer for the reason that a comment may be missed very easily!
All you have to do is add a dependency to the pubspec.yaml file:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
firebase_auth: ^1.0.2 # <--- add this line (doesn't have to be firebase_auth)
Run pub get to get the dependencies. If the command exists successfully, in the terminal you should see:
Process finished with exit code 0
The Podfile should have been created after running the command with the dependency listed and can then be found at ios/Podfile.
I found the Podfile and Podfile.lock in the ios folder as created by the Flutter tools, yet Pods.xcodeproj was missing in the Xcode view of the project.
I opened a command-line terminal, went into ios folder and ran
pod install
that was enough for me to fix the project.
you can use this command to find this issue https://docs.flutter.dev/development/add-to-app/ios/project-setup.
it's worked for me.
flutter build ios-framework --output=some/path/MyApp/Flutter/
use pwd command to get the current directory
replace --output=some/path/MyApp/Flutter/ by --output=currentdirectory/directoryapp/ios/Flutter
so
flutter build ios-framework --output=currentdirectory/directoryapp/ios/Flutter
for me it was:
flutter build ios-framework --output=/Users/ilimigroup/StudioProjects/Telia-ios/telia/ios/Flutter
after that, you can run in xcode
If you are on window please try this for pod file install in android studion
npx pod install
Adding default Podfile content if that can be helpful for someone, else if needed proper solution resolved this issue inside other question
# 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)
end
end
Easiest method that worked for me is just do:
pod init
in the terminal

Resources