FlutterFlow / flutterflow-issues

A community issue tracker for FlutterFlow.
130 stars 26 forks source link

Your Podfile is wrong and fails iOS build. #4807

Closed oneForCode closed 2 weeks ago

oneForCode commented 3 weeks ago

Can we access your project?

Current Behavior

Your Podfile is wrong and fails iOS build.

The problem is that you're using the firestore-ios-sdk-frameworks binary distribution while also having the regular Firebase pods installed. This can cause conflicts. Here's how to fix your Podfile:

# Add this line at the top $FirebaseSDKVersion = '11.2.0'

# Add these lines before flutter_install_all_ios_pods pod 'Firebase', :modular_headers => true pod 'FirebaseCore', :modular_headers => true pod 'GoogleUtilities', :modular_headers => true

# Update the Firestore pod to specify the branch pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :branch => "11.2.0"

Expected Behavior

iOS build used to work in Codemagic.

Steps to Reproduce

Running iOS build from the downloaded code in Codemagic produces this error:

 [!] CocoaPods could not find compatible versions for pod "FirebaseFirestore":
  In Podfile:
    FirebaseFirestore (from `https://github.com/invertase/firestore-ios-sdk-frameworks.git`, tag `11.0.0`)

    cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 5.4.4, which depends on
      Firebase/Firestore (= 11.2.0) was resolved to 11.2.0, which depends on
        FirebaseFirestore (~> 11.2.0)

Reproducible from Blank

Bug Report Code (Required)

IT4khc/1sIZ2pbxF7aXhbcFojik7OXoiTL07ttYbZxUjIuPtBJh+ePTCSFdDUt+6Y2lhHGaWhkYy+PzzjYflMMY6GwieG4BYwqtQbDnLTXq8RJSmCrmKWmtREdhUFVSY3JiNmwp7B7BiLE1n3TiIOu6saHbqGZ+/Zwh9f6PHaOI=

Visual documentation

Screenshot from 2024-11-02 09-47-09

Environment

- FlutterFlow version: 3.6.0
- Platform: iOS
- Browser name and version: N/A
- Operating system and version affected: iOS 14

Additional Information

No response

Alezanello commented 3 weeks ago

Hello!

I wasn’t able to investigate the issue fully because there’s a custom action in your project that has an error, which prevents me from reviewing the entire code. I tried replicating the issue in a new blank project, but I wasn’t able to reproduce it.

image.png
oneForCode commented 3 weeks ago

The error displayed in custom action is ignored by both "Test mode" and by APK builder. Both work despite of the "error".

To test the issue, you can "Download code", then try building it in Codemagic for iOS. It will succeed for Android, but fail for iOS with that error.

I solved the problem by updating the Podfile that FlutterFlow incorrectly generates.

I was hoping it might help other developers who struggle with it.

Alezanello commented 2 weeks ago

I’m glad everything is working as expected now! I’ll go ahead and close this issue, but if you encounter anything else, please don’t hesitate to open a new one!

TheBestLevel commented 1 week ago

Excuse me how do you update the podfile? I have the same issue. I am on a hurry to deploy to a client. Please help :)

If you want I can give you acceso to my proyect. I can not fix it

oneForCode commented 1 week ago

@TheBestLevel

Excuse me how do you update the podfile? I have the same issue. I am on a hurry to deploy to a client. Please help :)

If you want I can give you acceso to my proyect. I can not fix it

I downloaded code. Unzipped it. Than edited ios/Podfile Then checked it into my Github. Then ran Codemagic build from that repo.

The Podfile:

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

# Add this line at the top
$FirebaseSDKVersion = '11.2.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! :linkage => :static
  use_modular_headers!

  # Add these lines before flutter_install_all_ios_pods
  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true

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

  # Update the Firestore pod to specify the branch
  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :branch => "11.2.0"
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.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end