Firebase-ios-sdk: import Firebase no longer works

Created on 17 Jul 2020  路  21Comments  路  Source: firebase/firebase-ios-sdk

[REQUIRED] Step 1: Describe your environment

  • Xcode version: 12.0 beta 2
  • Firebase SDK version: 6.28.1
  • Firebase Component: Whole Firebase framework (Auth, Core, Database, Firestore, Messaging, Storage, etc)
  • Component version: 6.28.1
  • Installation method: CocoaPods (select one)

[REQUIRED] Step 2: Describe the problem

Steps to reproduce:

Just install firebase with some components like functions and firestore, then try to use firestore/functions with imported Firesbase.

What happened? How can we make the problem occur?
This could be a description, log/console output, etc.
After the update, importing Firebase in not enough to use firestore/auth/functions, it looks like import Firebase now do nothing

Zrzut ekranu 2020-07-17 o 14 32 20

But after remove import firebase, and add import for each component then it works
Zrzut ekranu 2020-07-17 o 14 33 24

That is a planned change or bug?

If you have a downloadable sample project that reproduces the bug you're reporting, you will
likely receive a faster response on your issue.

Relevant Code:

import Fireabse
let functions = Functions.functions() // this case doesn't work

////
import FirebaseFunctions
let functions = Functions.functions() // this one works

so it looks like the `import Firebase` is useless since new update right?
needs-info question

Most helpful comment

i have fixed the problem :

1) close xcode
2) removing Pods directory
3) removing xcworkspace directory
4) launch pod install again
5) open myproject.xcworkspace

i suspect that during my first pod install xcode was open

All 21 comments

Hi @Marcin951 - that certainly shouldn't be the case. In some cases I've seen this where Xcode is in a bad state - can you try a clean build, cleaning derived data, and re-launching Xcode?

Does this happen on the Xcode 12 beta 2 only, or also with Xcode 11? Just trying to figure out if this is a new issue related to the beta or something else going on.

If the above doesn't work, it's likely also worth trying to clean the CocoaPods folder and try rebuilding again.

Ya, I did it. I deleted the cocoa pods folder/cache and I did deinit cocoa pods. I deleted the derived data, cache and I cleaned the build. I tried a couple of times to build the project after clean build and always had the same issue. It looks like something went wrong in the latest version of the firebase. I also know that issue when sometimes Xcode can't detect firebase but always rebuild helps, so that definitely is the another issue

Are you able to reproduce in a quickstart sample?

Not sure if related, but I am having similar issues since I updated to last version (6.28.1) using Cocoapods 1.9.3.

I tried removing derived data, cleaning and building with no luck.

Screen Shot 2020-07-17 at 18 58 38

The import that I use is import Firebase

Using import FirebaseDatabase fixes the issue. Is this a bug or expected behavior?

Using import FirebaseDatabase fixes the issue. Is this a bug or expected behavior?

I'm pretty sure that is a bug, if they didn't mark it as change in the changelogs.
Tomorrow I'll create a brand new project to check if that is 100% issue

It would be a bug, but it doesn't repro in our tests, so we'll like need a reproducible example to diagnose.

I had the same issue with xcode 11.6, and is not the only library that is broken. In fact AFNetworking, but it works importing extra modules like import FirebaseDatabase

Zrzut ekranu 2020-07-20 o 13 17 42
Sample projects don't work, ofc i tried with cleaning build etc

on a brand new project, it looks like working
Zrzut ekranu 2020-07-20 o 13 26 30
But I don't know why, I also reinstalled pods on my main project, any clue? Cause a bunch of developers has that issue.
On my main project I still have that problem, cleaning build, deinit/init pods, and removing pods cache didn't help

maybe I can run unit tests in any way on my project?

Same behaviour, Xcode Version 11.5 (11E608c).

need to import FirebaseCore otherwise FirebaseApp is not defined

@paulb777 @ryanwilson How is going investigation? Can I help in any way?

Having the same issue as well with Xcode 12 / Firebase SDK version: 6.28.1 / Cocoapods

It works with Xcode 11.6, and it also works again with Xcode 12 if I add specific imports (the one's that are commented out here).
FirebaseIssue6066

@Marcin951 and others We still haven't been able to reproduce, so it would be really helpful to share an example that demonstrates the issue.

The other option would be to track down what is different about a working and broken environment. Perhaps, diff'ing the Pods directory would provide some clues ...

I have related issue with FirebaseCrashlytics.
I've installed it w/o Cocoapods, as described at https://firebase.google.com/docs/ios/setup#frameworks (I've added frameworks from FirebaseAnalytics and FirebaseCrashlytics, and I've followed steps for Firebase.h and module.modulemap)
Then, I followed instructions to upgrade from Fabric to FirebaseCrashlytics at https://firebase.google.com/docs/crashlytics/upgrade-sdk?platform=ios

import FirebaseCrashlytics and FirebaseApp.configure() resulted in "Use of unresolved identifier 'FirebaseApp'".

import Firebase resolved this error.
Is this expected behaviour?
Should import FirebaseCrashlytics work?
Is it safe to import Firebase instead of import FirebaseCrashlytics?

i have fixed the problem :

1) close xcode
2) removing Pods directory
3) removing xcworkspace directory
4) launch pod install again
5) open myproject.xcworkspace

i suspect that during my first pod install xcode was open

Oh okay then if that is solved I can close the issue!

Hi all. I'm still in trouble from last week. I have tried what sdnetwork specifies, and it only works at few times. It mainly fails when working with a physical device. With the simulator it compiles well.

Firebase installed pods:
pod 'Firebase/Analytics'
pod 'Firebase/DynamicLinks'
pod 'Firebase/Crashlytics'
pod 'Firebase/Messaging'
pod 'Firebase/RemoteConfig'

log from pod install:
Installing Firebase (6.28.1)
Installing FirebaseABTesting (4.0.0)
Installing FirebaseAnalytics (6.6.2)
Installing FirebaseCore (6.9.1)
Installing FirebaseCoreDiagnostics (1.5.0)
Installing FirebaseCrashlytics (4.3.0)
Installing FirebaseDynamicLinks (4.2.0)
Installing FirebaseInstallations (1.5.0)
Installing FirebaseInstanceID (4.5.0)
Installing FirebaseMessaging (4.6.0)
Installing FirebaseRemoteConfig (4.7.0)

XCode version: 11.6
physical device: iPhone 11 Pro iOS 13.6
CocoaPod version: 1.8.4
MacOS Catalina version: 10.15.6

Captura de Pantalla 2020-07-28 a la(s) 10 41 01

Got unresolved identifier FirebaseApp; XCODE 11.6. Had to import FirebaseCrashlytics directly.

See the resolution above. If that still doesn't work, we'll need a reproducible example to help with this issue.

Was this page helpful?
0 / 5 - 0 ratings