【发布时间】:2017-10-23 02:12:46
【问题描述】:
我正在尝试通过注册用户在 Firebase 中按相应的用户 ID 添加数据,但它给了我错误“unexpectedly found nil while unwrapping an optional value”现在我不知道这是怎么回事。但是当我使用代码而不分别在ref 中添加userID 时,数据添加成功。但是当我在ref 之后添加userID 时出现错误。
注册
let userID = FIRAuth.auth()?.currentUser?.uid
ref.child("user_registration").child(userID!).setValue(["username": self.fullName.text, "email": self.emailTextField.text,"contact": self.numberText.text, "city": self.myCity.text, "state": self.countryText.text, "gender": genderGroup, "blood": bloodGroup])
【问题讨论】:
-
请采纳其中一个答案
-
@VladPulichev 仍在寻找答案,因为数据没有像我预期的那样存储在 UID 中
-
ATM 怎么了?
-
我已经完成了。对不起。我已经写了,你需要做什么。使用您的注册码提出另一个问题。祝你好运。
-
还有一件事。试着首先考虑自己..
标签: ios firebase swift3 firebase-realtime-database firebase-authentication