简体   繁体   English

快速代码的Firebase错误

[英]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: 我已经尝试过Everythng,并且已经将Pod导入到我的项目中,在几个新项目中完成了几次,但是始终会收到此错误:

'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 导入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: 我可以在“输出/调试”窗口中看到与Firebase连接的状态,但是当我从代码开始时:

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 xcode错误:无法调用非功能类型模块Firebase的值

Unable to connect Firebase to my Xcode swift app? 无法将Firebase连接到我的Xcode swift应用程序?

图片代码

I have open many new projects, done it import pod many times, I have import pod with insert in my pod file: 我打开了许多新项目,多次导入pod,在pod文件中插入了insert的pod:

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? 插入了Pod,我看到了Firebase文件夹,我知道这没问题,那怎么可能出问题了? 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. 就像我说的,我看到我在Debug窗口中与Firebase连接,一旦我开始编码,就会出现错误,并且在每个这样的项目中都会出现错误,即使我尝试使用不同的方法和不同的代码也是如此。

Any ideas? 有任何想法吗?

You're either using the wrong version of Firebase, or following the wrong guide, depending on what you're trying to do. 您使用的是错误版本的Firebase,还是使用了错误的指南,具体取决于您要执行的操作。

Your pod config will install the latest version (3.2.1) while the code you've written is for 2.5.1 and before. 当您编写的代码适用于2.5.1及更低版本时,您的pod配置将安装最新版本(3.2.1)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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