昨日に引き続き、今回は、Firestoreにデータの保存(書き込み)ができるか、確認を行います。
Firestoreへの保存確認
import SwiftUI
import FirebaseCore
import Firebase
import FirebaseFirestore
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
Firestore.firestore().collection("users").document("Message").setData([
"UserMessage": "message",
"Date": "messageDate",
"UserId": "messageId",
], merge: false) { err in
if let err = err {
print("Error writing document: \(err)")
} else {
print("Document succesfully writen!")
}
}
return true
}
}
0 件のコメント:
コメントを投稿