Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No such module 'FirebaseDatabase'

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?

like image 421
Leem.fin Avatar asked Oct 09 '17 22:10

Leem.fin


3 Answers

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'
like image 191
iOS Geek Avatar answered Sep 22 '22 15:09

iOS Geek


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.

like image 42
Paul Beusterien Avatar answered Sep 24 '22 15:09

Paul Beusterien


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
like image 38
Ajay Singh Mehra Avatar answered Sep 23 '22 15:09

Ajay Singh Mehra