I have child that's including user informations. I need to change "FirstName" and "LastName" in the same time. How can I set child and value?.
我有孩子,包括用户信息。我需要在同一时间更改“FirstName”和“LastName”。我怎样才能设置孩子和价值?
3 个解决方案
#1
3
You can use updateChildValues
:
您可以使用updateChildValues:
var updates : [AnyHashable: Any] = ["your/path/firstName": firstName,
"your/path/lastName": lastName]
ref.updateChildValues(updates)
#2
0
I found the solution!!. Use "updateChildValues" instead of "setValue" in "child" key.
我找到了解决方案!!在“child”键中使用“updateChildValues”而不是“setValue”。
#3
-1
ref.child("users").child(uid).child("firstName").setValue(firstName)
ref.child("users").child(uid).child("lastName").setValue(lastName)
change the path to fit where your data is stored if necessary
如有必要,更改路径以适合存储数据的位置
#1
3
You can use updateChildValues
:
您可以使用updateChildValues:
var updates : [AnyHashable: Any] = ["your/path/firstName": firstName,
"your/path/lastName": lastName]
ref.updateChildValues(updates)
#2
0
I found the solution!!. Use "updateChildValues" instead of "setValue" in "child" key.
我找到了解决方案!!在“child”键中使用“updateChildValues”而不是“setValue”。
#3
-1
ref.child("users").child(uid).child("firstName").setValue(firstName)
ref.child("users").child(uid).child("lastName").setValue(lastName)
change the path to fit where your data is stored if necessary
如有必要,更改路径以适合存储数据的位置