invertase/firestore-ios-sdk-frameworks

Issue with using 8.4.0

Gene-Dana opened this issue · 5 comments

Hi there ! I ran into this issue

image

I solved it by switching to 8.3.0 and thought perhaps it would be useful to share !

Yes! The firestore dependency here must match the one used by everything else.

Note in your Podfile I believe it is possible to specify the version dynamically so they are in sync naturally without maintenance effort. I believe you will like this snippet:

https://github.com/FirebaseExtended/flutterfire/blob/1795261e09a73080703af3609dd198758b4f3032/packages/cloud_firestore/cloud_firestore/example/ios/Podfile#L37-L51

  if defined?($FirebaseSDKVersion)
    Pod::UI.puts "#{pubspec['name']}: Using user specified Firebase SDK version for FirebaseFirestore framework: '#{$FirebaseSDKVersion}'"
    firebase_sdk_version = $FirebaseSDKVersion
  else
    firebase_core_script = File.join(File.expand_path('..', File.expand_path('..', File.expand_path('..', File.expand_path('..', File.dirname(__FILE__))))), 'firebase_core/firebase_core/ios/firebase_sdk_version.rb')
    if File.exist?(firebase_core_script)
      require firebase_core_script
      firebase_sdk_version = firebase_sdk_version!
      Pod::UI.puts "#{pubspec['name']}: Using Firebase SDK version '#{firebase_sdk_version}' defined in 'firebase_core for FirebaseFirestore framework'"
    else
      raise "Error - unable to locate firebase_ios_sdk.rb script in firebase_core, and no FirebaseSDKVersion specified"
    end
  end


  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => "#{firebase_sdk_version}"

I do like that snippet ! I appreciate it, thanks !!!

Hey there ! just to be certain @mikehardy, I replace this with the code your provided above?

target 'Runner' do
  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.3.0'

  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

pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.3.0'

Podfiles themselves are code, and code is infinitely variable, so I cannot say 100% that you should do exactly this thing or exactly that thing.

I can say that the '8.3.0' reference will require manual maintenance from you going forward, and the goal of the snippet I posted was to show how to use ruby (the language of Podfiles) to programmatically feel around your apps' directory tree to find the firebase_core ruby config script, and use it to get your firebase-ios-sdk version, then use that version in place of 8.3.0 so it's dynamic.

You'll have to experiment in order to make it work exactly, it always takes me a few test/run/fix tries when I'm playing with Podfiles personally but I always get there in the end. Good luck!

I agree with the intention and approach ! Just wanted to make sure I was following your guidance ! thanks