swift4
xcode9.2
Realtime Databaseを実装したく、Firebase公式動画を見てコードを真似ていますが、
Use of undeclared type 'DataSnapShot'エラーが出ます。
FIRDatabaseSnapShotからDataSnapShotに変更になったかと思いますが、
ここ以外の問題箇所が分かりません。
お分かりになる方,よろしくお願いします。
↓この(MyPageViewController)はログインビューから遷移した先のビューです。
(MyPageViewController) import UIKit import Firebase import FirebaseAuth import GoogleSignIn class MyPageViewController: UIViewController { let conditionRef = Database.database().reference().child("condition") @IBOutlet weak var conditionLabel: UILabel! override func viewDidLoad() { super.viewDidLoad() } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) conditionRef.observeEventType(.Value) { (snap: DataSnapShot) in self.conditionLabel.text = snap.value?.description } } @IBAction func sunnyDidTouch(_ sender: Any) { conditionRef.setValue("Sunny") } @IBAction func foggyDidTouch(_ sender: Any) { conditionRef.setValue("foggy") } }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/12/19 03:19