如何使用Swift在Firebase中创建具有多个属性的用户? [英] How can I create a user with multiple attributes in Firebase with Swift?
问题描述
我对Firebase还是那么陌生(仅几个小时),但仍在尝试吸收其大部分概念.我遵循了文档,但是仍然找不到我的问题的直接答案.我的应用程序中有一个注册表格...它使用用户名,名称,移动设备等.我使用了firebase createUser函数,但是仅使用电子邮件和密码创建了一个用户.
I am so new to Firebase (a couple of hours only) and still trying to absorb most of its concepts. I followed the documentation but still found no direct answer to my question. I have a registration form in my app...it takes username, name, mobile, etc. I used the firebase createUser function but that only creates a user with email and password.
如何创建具有多个属性(名称,手机,用户名等)的用户?稍后,我想查询一个用户名并获取所有与它们相关的属性,因此我需要拥有这些属性.
How can I create a user with multiple attributes (name, mobile, username, etc)? Later on, I would like to query a username and get all associated attributes with them so to do that I need to have the attributes.
P.S.来自Parse,这并不是那么简单.
P.S. coming from Parse, this is not as straightforward.
推荐答案
传统上,您将在Firebase中创建一个/users节点,其中包含您要存储的有关该用户的任何其他信息.
Traditionally, you would create a /users node in Firebase that contains any other info you want to store about that user.
使用uid(user_id)作为每个用户的节点名.
Use the uid (user_id) as the node name for each user.
users
uid_0
name: "Bill"
food: "Pizza"
uid_1
name: "Ted"
food: "Tacos"
此问题已被询问过,因此请在询问之前尝试搜索与您类似的问题.
This question has been asked before so please try searching for questions similar to yours before asking.
此处有更多信息 Firebase用户节点
这篇关于如何使用Swift在Firebase中创建具有多个属性的用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!