我正在嘗試使用Firebase做兩個認證級別的iOS應用。 第二個驗證必須通過在文本字段中插入代碼巫婆位於數據庫中進行驗證。如何使用firebase在swift代碼上創建搜索字段?
//
// AccessoTerzoLivello.swift
// amesci
//
// Created by Gianluca Caliendo on 07/07/17.
// Copyright © 2017 Amesci. All rights reserved.
//
import UIKit
import Firebase
class AccessoTerzoLivello: UIViewController {
@IBOutlet weak var CodiceVolontarioTxt: UITextField!
@IBAction func Accedi(_ sender: UIButton) {
var rootRef: DatabaseReference!
rootRef = Database.database().reference()
var conditionalRef = rootRef.child("SchedaVolontari")
conditionalRef.observe(.value) {(snap: DataSnapshot) in }
if self.CodiceVolontarioTxt.text = snap
}
else {
let alert = UIAlertController(title: "Errore", message: "Codice volontario non valido", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "ok", style: UIAlertActionStyle.default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}
}
歡迎來到StackOverflow。查看SO的[如何使用](https://stackoverflow.com/help/how-to-ask)部分,並更新您的問題。還提供了迄今爲止嘗試的細節。 –