简体   繁体   中英

Firebase error with swift code

I have try everythng and I have imported pods to my project, done it several times in several new projects, but always get this error:

'Cannot call value of non-function type 'module'

Is it possible that my cocoa-pods are damaged somehow? When I insert this code:

import Firebase

let BASE_URL = "my_project_url"
var FIREBASE_REF = FIRDatabase.database().reference()

I can see in Output/Debug window that I am connected with firebase, but when I start with code:

let BASE_URL = "my_project_url"

let FIREBASE_REF = Firebase(url: BASE_URL)

var CURRENT_USER: Firebase
{
    let userID = NSUserDefaults.standardUserDefaults().valueForKey("uid") as! String

    let currentUser = Firebase(url: "\(FIREBASE_REF)").childByAppendingPath("users").childByAppendingPath(userID)

    return currentUser!
}

always get error. I have really try stuff from a lot tutorials, I tried a lot of things over past few days and nothing happened.

I have also look and read this topics, but did not help:

Cannot call value of non-function type 'module'

xcode error : Cannot call value of non-function type module Firebase

Unable to connect Firebase to my Xcode swift app?

图片代码

I have open many new projects, done it import pod many times, I have import pod with insert in my pod file:

pod "Firebase"

and like this:

pod "Firebase"
pod "Firebase/Database"

also tried like this:

pod 'Firebase', '>= 2.5.1'
pod "Firebase/Database"

but always the same problem. Pods are inserted, I see Firebase folder and I know this is OK, so what could be wrong? Like I said, I see that I am connected with Firebase in Debug window, as soon I start coding, error appears, and it is in every project like this, even when I try different approach and different code.

Any ideas?

You're either using the wrong version of Firebase, or following the wrong guide, depending on what you're trying to do.

Your pod config will install the latest version (3.2.1) while the code you've written is for 2.5.1 and before.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM