繁体   English   中英

在iOS中快速使用未声明的类型“ firebase”

[英]swift- use of undeclared type 'firebase' in ios

我已经安装了firebase的pod以及导入框架,并做了一切可能的..但是我仍然使用这种未声明的“ 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'。 确保在此之前进入项目目录。 这将自动导入框架。 但是,您确实需要在文件中写入import语句才能明显使用它

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

暂无
暂无

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

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