2

For me, there are two ways to generate a pod file after deleting it the first one is by running flutter pub get and then a pod file will be generated in the following form after some editing

# Uncomment this line to define a global platform for your project
 platform :ios, '10.0'
pod 'Firebase/Analytics' #ATTENTION PLEASE SHOULD I ADD THESE PODS HERE?
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
pod 'Firebase/Database'
pod 'Firebase/Messaging'

# 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 |pi|
    pi.pods_project.targets.each do |t|
      t.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0’
      end
    end
end

then running pod install


And the other implementation is when I run pod init i get the following after some editing:

# Uncomment the next line to define a global platform for your project
 platform :ios, '10.0'
pod 'Firebase/Analytics'
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
pod 'Firebase/Database'
pod 'Firebase/Messaging'

target 'Runner' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Runner

end

post_install do |pi|
    pi.pods_project.targets.each do |t|
      t.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0’
      end
    end
end

then run pod install... which is the right way to use flutter and build and run ios apps, as I am so confused and I can't run my app in ios form. more details are in this issue I would be pleased if someone helps me

2 Answers 2

7

Alright, in flutter you don't have to install the pods in your Podfile like pod 'Firebase/Messaging' just put them in your pubspec file, run pod cache clean --all, delete your Podfile then run flutter pub get and flutter will generate the Podfile for you, then you should just uncomment the second line and run pod install and run your app

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

1 Comment

% pod clean [!] Unknown command: clean`` Did you mean: cache? Correct command: pod cache clean --all
2

Did you try to delete pod folder and run flutter pub get and then pod install?

1 Comment

It will generate the first podfile mentioned.

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.