FirebaseIOS: Using Undeclared Type 'DatabaseReference'
Sorry for the strange question
Yesterday I had to update my firebase module before everything was fine, but after that I can no longer receive data
So here's my code
// let userID = FIRAuth.auth()?.currentUser?.uid
var rsef: DatabaseReference! // undeclared
rsef = Database.database().reference() //. undeclared
I have read the official instructions for installing firebase, they are correct, but I do not know why it is talking about not declared
For reference, here's my complete code
ref.child("KurdishRsta").child((FIRAuth.auth()?.currentUser?.uid)!).childByAutoId().queryOrderedByKey().observe(.childAdded, with:
{ (snapshot) in
print("Database\(String(describing: snapshot.value))")
let value = snapshot.value as? NSDictionary
let FullRsta1 = value?["Rsta"]
let FullMeaning1 = value?["Meaning"]
self.RetrivedRsta.insert(RstasFromFirebase(FullRsta:FullRsta1 as! String ,FullMeaning : FullMeaning1 as! String), at: 0)
self.tableview.reloadData()
})
}
podfile
Target 'Dictionary' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
pod 'SDWebImage', '~>3.8'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
pod 'Firebase/Database'
# Pods for Dictionary
pod 'SVProgressHUD'
pod 'SKSplashView'
pod "FGTranslator"
pod 'SCLAlertView-Objective-C'
pod 'OneSignal'
pod 'Google/Analytics'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
pod 'Firebase/Database'
pod 'ChameleonFramework'
pod 'QMChatViewController'
pod 'ApiAI'
pod 'Firebase/RemoteConfig'
pod "ZHPopupView"
pod 'FCAlertView'
pod 'JSQMessagesViewController'
pod "CZPicker"
pod 'DTTJailbreakDetection'
pod 'MBProgressHUD', '~> 1.0.0'
pod 'PayPal-iOS-SDK'
source to share
if it worked before it should be a pod file, here for reference.
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'Firebase/Database'
pod 'Firebase/Crash'
pod 'Firebase/Auth'
pod 'FacebookCore'
pod 'FacebookLogin'
target 'MyAwesomeApp' do
# Comment this line if you're not using Swift and don't want to use
dynamic frameworks
use_frameworks!
# Pods for MyAwesomeApp
target 'MyAwesomeAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAwesomeAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
source to share
In my case, git was ignoring the directory Pods
so every time I changed the branch I had to run a command pod install
(small configuration changes).
In one of these changes, I started getting this error. I tried to clear the build folder, delivery data folder, restart, and nothing worked until I deleted the contents of the Pods directory and ran pod install
.
source to share
Swift version 5, Firebase (6.5.0), FirebaseAnalytics (6.0.4), FirebaseDatabase (6.0.0)
Follow the instructions on the google page
Previously the usage has import FirebaseDatabase
been removed. Use only import Firebase
in Swift file and to use database reference the variable can be used likevar firebaseDatabaseRef: DatabaseReference!
If the problem persists, try cleaning and building the project a couple of times, or use the following commands from the terminal and try cleaning and building again.
$pod deintegrate
and then
$pod install
Subfile :
pod 'Firebase/Analytics'
pod 'Firebase/Database'
source to share