[英]Firebase IOS on Swift: Use of undeclared type 'DatabaseReference'
[英]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.