How to Fix Cannot Find 'Firebaseapp' in Scope

Cannot resolve symbol 'FirebaseApp', 'FirebaseOptions', and 'GoogleCredentials'

This scope:

<scope>runtime</scope>

is documented as:

This scope indicates that the dependency is not required for compilation, but is for execution. Maven includes a dependency with this scope in the runtime and test classpaths, but not the compile classpath.

So it's not surprising the compiler can't find it. Remove the scope and that should fix the FirebaseApp and FirebaseOptions failures. For GoogleCredential, you need to import com.google.api.client.googleapis.auth.oauth2.GoogleCredential.

Firebase doesn't build on M1 simulator (Cannot find 'Analytics' in scope)

Go to Project (NOT TARGET)

  • Build Settings
  • Excluded Architectures
  • Debug -

Add a new setting called

Any iOS Simulator SDK - arm64

If you are using Pods, you should repeat above for your Pods PROJECT as well.

Some pod targets (like pod KeychainAccess in your case) might not be respecting what you had set at Pods PROJECT level, you might want to fix this exact same thing for offending Pod targets as well.

Or instead of checking all of the pod targets one by one, you could add this at the end of your podfile -

post_install do |installer|
installer.project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
end

After doing this, do a pod install and a clean build, you should be good to go.

Cannot import Firebase in Swift app

You shouldn't need to use a Bridging Header.

The Firebase SDK uses Swift module mapping, so you'll have to let CocoaPods know.

Use this podfile:

use_frameworks! # this allows you to use import Firebase
pod 'Firebase', '>= 2.5.0'

Then you should be able to use import Firebase in any Swift file.

Sometimes after opening from CocoaPods install, XCode can get confused. Do a Cmd+K to clean and a Cmd+Shift+R to rebuild. If that still is giving you errors, then restart Xcode and try the clean and build again.

Error: `call FirebaseApp.configure() before using Firestore`

Firstly, I would like to thank @DionzB for suggesting using singletons (which I did). I will reference his/her post in this answer.

Ok, so after some research and playing with breakpoints, I found that my custom class actually executes before the AppDelegate. Knowing such, I created a variable before the following line:

static let shared = FirebaseService()

the name does not matter, because I/you will not call it, and assign it to FirebaseApp.configure()

The FirebaseService class becomes:

class FirebaseService: NSObject {
let constantToNeverTouch = FirebaseApp.configure()
static let shared = FirebaseService()

init() {
}
}

Next, you must make sure that FirebaseApp.configure() is no where else in your code. It should not be in the AppDelegate either. Having multiple FirebaseApp.configure()'s crashes the app.



Related Topics



Leave a reply



Submit