我想在用户登录时制作身份验证数据。
这是我的代码:
Public Sub TransposeRows3() 'insert J cell while looping
Dim ws As Worksheet, lr As Long, c As Long, t As Long
Set ws = ActiveSheet
lr = ws.Cells(ws.Rows.Count, "D").End(xlUp).Row
c = 2
t = 2
Application.ScreenUpdating = False
While c <= lr
ws.Range("A" & c).Copy ws.Range("J" & t & ":K" & t)
ws.Range("L" & t).Resize(, 7) = WorksheetFunction.Transpose(ws.Range("D" & c).Resize(7))
c = c + 7
t = t + 1
Wend
Application.ScreenUpdating = True
End Sub
这是我的Json:
let ref = Database.database().reference().child("data")
ref.observeSingleEvent(of: .childAdded, with: { (snapshot) in
let value = snapshot.value as? NSDictionary
let score = value?["data"] as? String ?? ""
if userPhone == score{
self.performSegue(withIdentifier: "loginSuccessSegue", sender: nil)
}else{
self.performSegue(withIdentifier: "loginButtonSegue", sender: nil)
}
})
答案 0 :(得分:0)
将.childAdded替换为.value。它应该工作。
ref.observeSingleEvent(of: .value, with: { (snapshot) in
let value = snapshot.value as? NSDictionary
let score = value?["data"] as? String ?? ""
}