未声明Firebase参考 [英] Firebase References undeclared

查看:86
本文介绍了未声明Firebase参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个新的Xcode项目,将"Firebase" pod添加到我的pod文件中并安装了它,并根据Firebase文档添加了Google-services.plist文件和其余的文件.

I created a new Xcode project, added the 'Firebase' pod to my pod file and installed it, and added the Google-services.plist file and the rest according to the Firebase documentation.

导入Firebase 工作正常,但如果我尝试

import Firebase works fine, but if I try

var ref:FIRDatabaseReference!

在同一个ViewController中,则会引发错误:

in the same ViewController, then it throws an error:

使用未声明的类型'FIRDatabaseReference'

Use of undeclared type 'FIRDatabaseReference'

对于任何Firebase参考,都会发生这种情况.有什么想法吗?我是Swift和xCode IDE的新手.

And this happens for any Firebase References. Any ideas on this? I am very new to Swift and the xCode IDE.

推荐答案

遇到了同样的问题,但是过了一会儿,我意识到我在Pod文件中缺少一个条目,您的Pod文件应该包含:

Just had the same problem, but after a while I realized that I was missing an entry in the pod-file, your pod-file should contain:

pod 'Firebase/Database'

希望它现在可以工作:)

Hope it works now :)

这篇关于未声明Firebase参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆