Cannot call value of non-function type 'module

2020-02-07 01:51发布

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 ?

7条回答
We Are One
2楼-- · 2020-02-07 02:13

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

查看更多
疯言疯语
3楼-- · 2020-02-07 02:13

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.

查看更多
Animai°情兽
4楼-- · 2020-02-07 02:17

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!
查看更多
孤傲高冷的网名
5楼-- · 2020-02-07 02:32

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 :)

查看更多
▲ chillily
6楼-- · 2020-02-07 02:32

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

查看更多
forever°为你锁心
7楼-- · 2020-02-07 02:33

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

查看更多
登录 后发表回答