Edward Du
Edward Du

Reputation: 123

Cannot call value of non-function type 'module<Firebase>'

i have a strange error when i was using firebase from google.

when i trying to init the Fire base setup the ref address for it using this code here

let BASE_URL = "YOUR_FIREBASE_URL"
var FIREBASE_REF = Firebase(url: BASE_URL)

, it shows an error:

Cannot call value of non-function type 'module<Firebase>'

my pod file looks like this:

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

target 'Mission Board' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  pod 'Firebase', '>=2.4.2'
end

Environment: Xcode 7.3.1 (7D1014) Firebase straight from the official site. Swift language.

please anyone help ?

Upvotes: 9

Views: 10092

Answers (7)

AnLT
AnLT

Reputation: 599

Firebase is belonged to Google now. I had many updates. Please, take a look at: https://firebase.google.com/support/guides/firebase-ios

Upvotes: 0

tomW
tomW

Reputation: 191

My pod file looks like this :

platform :ios, ‘9.2’

    use_frameworks!

target 'firebaseWithChris' do

    pod 'Firebase'

    pod 'Firebase/Database'

end

Xcode:in viewController.swift file in viewDidLoad method

instead of

var rootRef = Firebase(url:"https://<YOUR-FIREBASE-APP>.firebaseio.com")

try

var rootRef = FIRDatabase.database().reference()

This worked for me :]

Upvotes: 6

KevinS
KevinS

Reputation: 607

I ran into this same problem. You might be referring to some sample code for Firebase.com. The API has been updated and is no longer referred to as "Firebase.com" It's not clear what the new name is -- ?

Anyway, the link below guides you through updating your podfile to include:

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

https://firebase.google.com/support/guides/firebase-ios

remember to run

pod update 

and changing your code to call the new methods. It's working for me with Xcode 7.2

Upvotes: 2

tsig
tsig

Reputation: 148

I'm also new to Firebase and run in the same problem. It seems that Firebase 3.2.0 and FirebaseDatabase 3.0.1. use different approach. The following worked for me:

let rootRef = FIRDatabase.database().referenceFromURL(BASE_URL)
var messageRef: FIRDatabaseReference!

Upvotes: 4

nivritgupta
nivritgupta

Reputation: 1966

i also face the same issue . i delete the ccocoa pod and follow this link to install the firebase through cocoapod . after that i am able to solve this problem

Step 1 :- you need CocoaPods 1.0.0 or later

Step 2 :- Create a Firebase project in the Firebase console,

Click Add Firebase to your iOS app and follow the setup steps. If you're importing an existing Google project, this may happen automatically and you can just download the config file.click here

Step 3 :- Add the SDK

pod 'Firebase'

now Initialize Firebase in your app

https://firebase.google.com/docs/ios/setup#add_the_sdk

Thanks

Upvotes: 0

benji
benji

Reputation: 11

I had the same issue. In order to resolve it, you have to modify your podfile. I wrote in my podfile those two lines (as it was asked by firebase in its intro video: https://www.youtube.com/watch?v=joVi3thZOqc)

pod 'Firebase'

pod 'Firebase/Database'   

hope it will help you :)

Upvotes: 1

EberronBruce
EberronBruce

Reputation: 330

I had the same issue. So, this is what I did to resolve it. I uninstall Firebase Cocoapods. Then I installed Firebase manually.

I used this link.
https://www.firebase.com/docs/ios/alternate-setup.html
and added the frameworks and dependencies that states on the this url.

Note: These libraries.
libicucore.dylib
libc++.dylib
Should be .tbd

The answer was given here.
Xcode compile error with Firebase

After I manually installed Firebase the error went away. If anyone knows why I would love to know myself what caused this error.

Note: Google updated Firebase. So, maybe you look more into that.

Upvotes: 1

Related Questions