[ad_1]
I wish to make a firestore name each time the app opens. however the line of accessing firestore or the completion just isn’t being executed.
class MoodAnalysisFirestoreManager{
personal let db = Firestore.firestore()
static let shared = MoodAnalysisFirestoreManager()
personal let currentUser = AuthManager.shared().getCurrentUserSafe()!
personal init(){}
public func addNewDayToCloud(){
let todayName = Date().getTodayName(date: Date()).uppercased()
let safeDate = safeDateString(date: Date())
let ref = db.assortment("MoodAnalysis").doc(currentUser)
ref.assortment("evaluation").doc(safeDate).setData([
"day": todayName,
"date": Date(),
"neutralCount": 0,
"angryCount": 0,
"sadCount": 0,
"happyCount": 0,
"Count":0,
"emotionVal":0
]){
error in
print(error)
}
}
if I referred to as MoodAnalysisFirestoreManager.shared.addNewDayToCloud() from the app delegate it doesn’t add something to the firestore, but when I make any kind of retrieving knowledge from the cloud it really works tremendous or, calls this perform in different view controllers every little thing works tremendous.
[ad_2]
