No such module 'FirebaseDatabase'

12,383

Solution 1

Just try this , Make sure to Update all pods and secondly we don't need to explicitly import FirebaseDatabase , Just write import Firebase and you are done

import Foundation
import Firebase

class myDatabase {
    var DbReference = DatabaseReference()
}

My podFile

pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
pod 'Firebase/Database'

Solution 2

Build the project.

The project needs to be built once for modules that come from CocoaPods to get installed into Xcode's ModuleCache (~/Library/Developer/Xcode/DerivedData/ModuleCache/) and be available for the editor's syntax checking.

Solution 3

As per previous comment please check the above whether you are using:

  1. .xcworkspace or not
  2. Check your target name
  3. Uninstall all pod and update your pod repo and than re install Pod
Share:
12,383
Leem.fin
Author by

Leem.fin

A newbie in software development.

Updated on July 24, 2022

Comments

  • Leem.fin
    Leem.fin almost 2 years

    I am developing iOS app with Swift 3 with Firebase database.

    My Podfile:

    target 'MyApp' do
      # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
      use_frameworks!
    
      # Pods for MyApp
      pod 'Firebase/Core'
      pod 'Firebase/Auth'
      pod 'Firebase/Database'
    end
    

    I run pod install, which installs the pods.

    I created a class:

    import Foundation
    import FirebaseDatabase // Error: no such module 'FirebaseDatabase'
    
    class MyDatabase {
        var ref: DatabaseReference!
        ...
    }
    

    But I get compiler error no such module 'FirebaseDatabase', why?

  • Leem.fin
    Leem.fin over 6 years
    I did everything you mentioned, I get use of unresolved identifier 'DatabaseReference'
  • iOS Geek
    iOS Geek over 6 years
    Did you Tried Clean (window+shift+k) and close project , Reopen and Build (window+b)
  • Paulo Mattos
    Paulo Mattos over 6 years
    This is a necessary runtime step as well. But he got a buildtime error, so he needs to look elsewhere ;)
  • Surbhi Garg
    Surbhi Garg over 4 years
    I am adding firebase without cocoapods and getting same error, Can you please let me know what needs to be done. Please help