ios - swift-在ios中使用未声明的类型 'firebase'

标签 ios swift

我已经安装了 firebase 的 pod 并导入了框架,并且已经做了一切可能的事情..但我仍然遇到了这种使用 undeclare 'firebase' 的错误。
导入 UIKit 导入 JSQMessagesViewController 导入 Firebase

class ChatViewController: JSQMessagesViewController  {
    var ref: Firebase
    @IBOutlet weak var blackBtn: UIButton!
    @IBOutlet weak var menuView: UIView!
    @IBOutlet weak var TypeTxt: UITextField!
    var messages = [JSQMessage]()
    var outgoingBubbleImageView: JSQMessagesBubbleImage!
    var incomingBubbleImageView: JSQMessagesBubbleImage!

    override func viewDidLoad() {
        super.viewDidLoad()
      ref = Firebase(url: "https://candleheart-6bee6.firebaseio.com/")
//    var ref = Firebase(url:"https://fir-example-fea13.firebaseio.com/names")
//    ref.setValue(["name":"mamta"])
//           title = "ChatChat"
        setupBubbles()
        collectionView!.collectionViewLayout.incomingAvatarViewSize = CGSizeZero
        collectionView!.collectionViewLayout.outgoingAvatarViewSize = CGSizeZero
       // messageRef = rootRef.childByAppendingPath("messages")
        TypeTxt.layer.cornerRadius = 22.0
        TypeTxt.layer.borderWidth = 2.0
        TypeTxt.layer.borderColor = UIColor.whiteColor().CGColor
         TypeTxt.layer.backgroundColor = UIColor.whiteColor().CGColor
    }

最佳答案

您是否构建并清理了该项目?

通过 CocoaPods 添加框架后,在大多数情况下,您应该立即清理并构建项目。

这应该负责向您的应用添加/构建新框架并使其处于事件状态以供使用

此外,请注意,添加 pod 后将创建项目的另一个副本,名称类似于“yourProjectName.xcworkspace”(您可以在目录中找到它)。它将有一个浅蓝色缩略图。添加 Pod 后,您必须开始使用项目的该副本而不是普通项目。

//注意:通常使用 CocoaPods,当您将 pod 添加到 Podfile 时,您只需保存 Podfile 并在终端中输入“podinstall”即可。确保在此之前到达您的项目目录。这将自动导入框架。但是,您确实需要在文件中编写导入语句才能明显地使用它

您不需要显式导入框架(如果使用 Cocoa Pods)

关于ios - swift-在ios中使用未声明的类型 'firebase',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38201685/

相关文章:

android - iOS(如 Android)支持的语言/地区列表是什么?

ios - Stripe Radar 规则不适用于 Apple Pay 待授权

ios - 如何在不重置位置的情况下更改UIButton?

ios - AFAmazonS3Manager 可接受的图像内容类型

ios - 执行 UINavigationController 异常

ios - 在 iOS 中实现捏合缩放(如 UIWebView 中所示)

ios - 如何将 "combine"两个 UIImageView 合并到一张图像中?喜欢 Photoshop 图层合并吗?

ios - 修复具有大量状态的巨型 View Controller

ios - 如何修复 Twilio 可编程语音错误 - 52134 无效的 APNs 设备 token

ios - 在 iOS 13 上的 UIScrollView 中设置 UIRefreshControl