Cocoapods error after installing "firebase_firestore" Flutter plugin [duplicate] - firebase

This question already has answers here:
Conflicts with FlutterFire and native GeoFire plugin on iOS
(2 answers)
Closed 5 years ago.
I've got my app working with the Firebase RTDB but want to experiment with Firestore so I have followed the instructions and installed the 'firebase_firestore' plugin.
When I run my app now I get the following error:
Resolving dependencies of `Podfile`
[!] Unable to satisfy the following requirements:
- `Firebase/Firestore` required by `firebase_firestore (0.0.1)`
Specs satisfying the `Firebase/Firestore` dependency were found, but they required a higher minimum deployment target.
I've tried specifying platform :ios, '9.0' and also 10.0in my Podfile but that didn't make any difference. All other pods install fine.
Here's the entire Cocoapods run log: https://pastebin.com/raw/SBz8Bqgf
My Podfile looks like this (standard Flutter Podfile):
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
if ENV['FLUTTER_FRAMEWORK_DIR'] == nil
abort('Please set FLUTTER_FRAMEWORK_DIR to the directory containing Flutter.framework')
end
target 'Runner' do
# Pods for Runner
# Flutter Pods
pod 'Flutter', :path => ENV['FLUTTER_FRAMEWORK_DIR']
if File.exists? '../.flutter-plugins'
flutter_root = File.expand_path('..')
File.foreach('../.flutter-plugins') { |line|
plugin = line.split(pattern='=')
if plugin.length == 2
name = plugin[0].strip()
path = plugin[1].strip()
resolved_path = File.expand_path("#{path}/ios", flutter_root)
pod name, :path => resolved_path
else
puts "Invalid plugin specification: #{line}"
end
}
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
Here's a link to the Podfile.lock, maybe that's more interesting. I see that it has not been updated with Firestore though, presumably because the run fails: https://pastebin.com/raw/hj2jHE76

In case anyone else stumbles across this issue I just wanted to expand on V. Roussel's answer (which I marked as the correct answer), since Flutter kind of abstracts away this Cocoapods process. Here's what I did to be able to run "pod repo / update":
Run pod repo update
Set the environment variable FLUTTER_FRAMEWORK_DIR to something that looks like /Users/youruser/bin/flutter/bin/cache/artifacts/engine/ios/. You can do a locate Flutter.podspec to find this directory
From YourFlutterProject/ios run pod update
After this you should be able to run your app again.

cloud_firestore has progressed to 0.03 by now, which should allow you to run the PODs.
in pubspec.yaml
cloud_firestore: "^0.0.3"
If that does not work from the start, add Firebase core to your podfile and run pod install.
Note: As far as I have seen, you cannot yet combine Firestore with other modules such as Firebase auth or Firebase analytics.

Related

FirebaseAuth Problem after Installing RevenueCat CocoaPod

I recently had put banner and interstitial ads on my application. After which, I decided to incorporate RevenueCat. Once the pod was installed, I had many errors that I could not fix. I decided to remove the CocoaPod. Once that was completed, I had been getting the following problems.
AVFoundation.h – AVFCore/AVFcore.h file not found
RPBroadCastExtension.h. – Could not build module AVFoundation
GameKit.h. – Could not build module ReplayKit
FIRGameCenterAuthProvider.m – Could not build module GameKit
I have been trying for 2-3 days to fix the problem. Here is what I have been doing.
I tried removing all pods and reinstall all the pods.
I try to clean the build. Same error came back.
I tried to add and remove RevenueCat.
I changed build setting to enable module c & Objective C. I added use_modular_headers! to Pod file.
my pod file
target 'FetalGrowthPercentile' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
use_modular_headers!
# Pods for FetalGrowthPercentile
pod 'Firebase/Firestore'
pod 'Google-Mobile-Ads-SDK'
pod 'Firebase/Auth'
end
None of which helps. I am lost. Please advise!!
Louis

Crash when using Firebase with Swift Framework

I use Swift Frameworks (Cocoa Touch Framework) to segment code into fairly independent modules.I have imported several external libraries, with Cocoapods, into the main app and those modules without any issues so far.
Xcode 9.3
iOS 11.2
CocoaPods 1.5
GoogleToolboxForMac (2.1.3), Firebase (4.13.0), FirebaseAnalytics (4.2.0), FirebaseCore (4.0.20), FirebaseDatabase (4.1.5), FirebaseInstanceID (2.0.10)
However when I import Firebase in any of those modules, in addition to importing it in the main app, my application crashes.
I don't even need to use anything from Firebase in the modules ; simply adding the pod to the target (module Store in this case) in the Podfile will crash the app as soon as I leave the main window (fira_viewDidDisappear).
There is also a long list of issues during startup (that were also reported by others), all similar to :
objc[36264]: Class FIRAIdentifiers is implemented in both /{$userdir}/Library/Developer/Xcode/DerivedData/FrameWork101-aekmajbumgzabmayoanlcrwtzbcs/Build/Products/Debug-iphonesimulator/Store.framework/Store (0x105478318) and /{$userdir}/Library/Developer/CoreSimulator/Devices/31D920E9-CD46-47C4-9631-503B3471AAF7/data/Containers/Bundle/Application/57B8020D-E2AB-4A06-B654-5F26F8E00AF6/FrameWork101.app/FrameWork101 (0x103b1ef80). One of the two will be used. Which one is undefined.
Pretty ominous statement...
There are several threads somewhat related to this :
How do I Integrate the Firebase cocoaPods in my custom swift framework?
Building a swift Cocoa Touch framework with Firebase as a dependency
And even an issue (#6619) filed...
But they don't have a clear resolution / answer and the issue has even been closed without any resolution.
So is there a way to use Firebase in a modular approach (using frameworks) ? If so what's the best way to make this works ? Or is the Firebase SDK too invasive to do so ?
Thanks !
Podfile :
project 'FrameWork101.xcodeproj'
platform :ios, '11.2'
target 'Binding' do
use_frameworks!
pod 'ReactiveKit'
pod 'Bond'
end
target 'Model' do
use_frameworks!
target 'ModelTests' do
inherit! :search_paths
end
end
target 'Service' do
use_frameworks!
pod 'ReactiveKit'
pod 'Bond'
end
target 'View' do
use_frameworks!
pod 'ReactiveKit'
pod 'Bond'
end
target 'Store' do
use_frameworks!
pod 'ReactiveKit'
pod 'Bond'
pod 'Firebase/Database' <---- comment this out and it works fine.
end
target 'FrameWork101' do
use_frameworks!
pod 'Firebase/Core'
pod 'ReactiveKit'
pod 'Bond'
target 'FrameWork101Tests' do
inherit! :search_paths
end
end
And part of the crash report :

Pod Update of Firebase throwing errors

I am trying to install the Firebase Performance SDK and following their instructions on the site:
https://firebase.google.com/docs/perf-mon/get-started-ios
When I run the pod install step it gives me the following error:
firebase performance required by podfile
I run the pod update command and everything runs on the pod install but then when I open up my workspace I get errors in swift as such:
FIRDatabaseReference has been renamed to DatabaseReference
FIRDatabase has been renamed to Database
FIRFirebase.database().reference is now Database.database.reference
which then give the error
Database has no member reference
What gives!? Has anyone gotten these error after updating their podfile with Firebase!?
Pod file is as such:
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
target 'Pool' do
# Uncommnet this line if you're using Swift
use_frameworks!
#Pods for firebase pool
pod 'Firebase', '>=2.5.1' <--- This has been removed from the podfile as suggested
pod 'Firebase/Core'
pod 'Firebase/Performance'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Storage'
pod 'Firebase/Crash'
target 'PoolTests' do
# inherit! :search_paths
end
target 'PoolUITests' do
# inherit! :search_paths
end
end
Result of pod install
Error in xcode after pod install/update:
Here's a guide for upgrading Firebase iOS:
https://firebase.google.com/support/guides/firebase-ios
With 4.0 in particular, the Swift interfaces have been cleaned up to make it more "Swifty" which is why you're seeing those rename warning.
After the renaming, accessing the database reference should look like:
let ref:DatabaseReference = Database.database().reference()
For the updated docs of the new swift interface, see here:
https://firebase.google.com/docs/reference/ios/firebasedatabase/api/reference/Classes/FIRDatabase
The release of Firebase 4.0 on May 17 has the changed the naming convention and can be found in this naming migration guide:
https://firebase.google.com/docs/reference/ios/naming-migration-guide

EXC_BAD_ACCESS code=2 on including Firebase/Auth in Podfile

I am getting EXC_BAD_ACCESS after including 'Firebase/Auth' in Podfile. This happens without adding any line of firebase code. I am using swift3 on xcode 8 and the resultant pods are -
Installing Firebase (3.8.0)
Installing FirebaseAnalytics (3.5.1)
Installing FirebaseAuth (3.0.6)
Installing FirebaseCore (3.4.4)
Installing FirebaseInstanceID (1.0.8)
Using GTMOAuth2 (1.1.4)
Using GTMSessionFetcher (1.1.7)
Using GoogleAppUtilities (1.1.2)
Installing GoogleInterchangeUtilities (1.2.2)
Using GoogleSignIn (4.0.1)
Using GoogleSymbolUtilities (1.1.2)
Installing GoogleToolboxForMac 2.1.0 (was 2.1.0)
Using Localize-Swift (1.6)
Using ProtocolBuffers-Swift (3.0.6)
Using QorumLogs (0.9)
The error comes in Thread 1 in [UIViewController(FIRAScreenClassName) fira_viewDidAppear:]:
This happens only if the pod target is itself a framework which is embedded in an app eventually.
I do have Google analytics as well. Is it because ARC is not enabled? How do I do that on xcode-8?
Any other options to try?
There appears to be a problem in the latest Firebase/Core (3.8.0) release. Even #IBDesignable was crashing with a recursive call to the method signature you mentioned.
You have a couple of options:
In Info.plist (app), set FirebaseAutomaticScreenReportingEnabled to NO (bool). This solved the problem for my running application, but IBDesignable resources caused this error on build:
file:///path/to/project/Base.lproj/Main.storyboard: error: IB Designables: Failed to render and update auto layout status for UIViewController (svZ-78-1Mn): The agent crashed
You may want to temporarily downgrade to 3.7.1, for example,
pod 'Firebase/Core', '~> 3.7.1'
pod 'Firebase/Auth'
pod 'Firebase/Database'
The rest of the dependencies should take care of themselves when you run pod update.
I made a silly mistake. Never turned on Google under Authentication -> Sign in methods on Firebase
I am suspecting that the Podfile is not correct. I got into similar problem by adding Firebase dependency into a framework and I ran into the problem like this
objc[12345]: Class FIRAAppEnvironmentUtil is implemented in both
/Users/...Build/Products/Debug-iphonesimulator/SomeFramework.framework/SomeFramework
(0x105ef7fc8) and /Users/.../CurrentProject.app/CurrentProject
(0x105945108). One of the two will be used. Which one is undefined.
As mentioned in this post, you might have duplicate dependencies in different targets which could lead to weird bug like this. Adding Firebase pod into the main target and removing the Firebase pod from the framework fixed the problem for me.

How to upgrade new Firebase app from exist old app?

There are "create new app" or "import from google project" only in new Firebase console.( https://console.firebase.google.com/ )
How to update exit old app to new one?( https://www.firebase.com/account/#/ )
---Edit
This issue looks like already fixed.
I think the cause is 500 request error on new Firebase console.
However it had fixed already.
If you are already signed in to the new Firebase Console with the same Google account as you used on firebase.com, then you should see your firebase.com project listed under "Projects currently at Firebase.com".
Follow the instructions on the new Firebase upgrade page for Web, Android or iOS.
I've had a somewhat similar problem. I see the import button but when I click it, and select the project I want to load, it only displays the spinner. Ive even tried to import JSON from an old firebase project (before the upgrades) and it just spins. Could it be that the old JSON is not what the new firebase is expecting?
EDIT
OK, seems it doesn't like Chrome. Works in IE 11 but not Chrome 50.0.2
This is how you update a Firebase < 3.0 app to Firebase 3.
Step 1
Install Regular Firebase - pod 'Firebase', '>= 2.5.1'
Or
If considering your old app is already Firebase < 3.0 you should be fine.
Step 2
Update - pod update
*At this point it will take a good couple minutes to update. You should see something like this.
Update all pods
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Installing Firebase 3.2.0 (was 3.2.0)
Using FirebaseAnalytics (3.2.0)
Installing FirebaseAuth (3.0.2)
Using FirebaseDatabase (3.0.1)
Using FirebaseInstanceID (1.0.6)
Using GoogleInterchangeUtilities (1.2.1)
Installing GoogleNetworkingUtilities (1.2.1)
Using GoogleSymbolUtilities (1.1.1)
Using GoogleUtilities (1.3.1)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 4 dependencies from the Podfile and 10
total pods installed.
Step 3
Now you should have Firebase 3. So you can add frameworks like such in your pod file then pod update
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'xMarket' do
end
target 'xMarketTests' do
end
target 'xMarketUITests' do
end
pod 'Firebase', '>= 2.5.1'
pod ‘Firebase/Core’
pod ‘Firebase/Database’
pod ‘Firebase/Auth’
Good luck!
P.S. You will also have to edit your codebase because Firebase 3 is different than Firebase 2. Check the documentation here Firebase 3 Examples
Above answers look great. I'll just add one link that has a lot of the common differences between Firebase 2 and Firebase 3: https://firebase.google.com/support/guides/firebase-ios#get_a_database_reference_numbered
(I didn't see this at first and wasted a few hours yesterday trying to figure it all out.)

Resources