【问题标题】:Best way to set the currentUserID Using Firebase Auth and Swift使用 Firebase Auth 和 Swift 设置 currentUserID 的最佳方法
【发布时间】:2016-09-20 20:49:10
【问题描述】:

我正在使用 Firebase 构建应用。我想知道用 Swift 和 Firebase 设置当前用户会话的最佳方式是什么。我是否应该创建一个用户对象并将 ID 作为属性分配给该对象,然后在用户注销时将其设置为零?或者有没有更简单的方法在视图控制器之间共享 currentUserID?

【问题讨论】:

  • 你能说的更清楚一点,你只是想访问当前用户的 UID 吗?

标签: ios swift firebase firebase-authentication xcode8


【解决方案1】:

Firebase 提供了解决方案:

let userID: String = FIRAuth.auth()!.currentUser!.uid
print(userID)

刚刚发现。

【讨论】:

    猜你喜欢
    • 2015-11-29
    • 2017-07-26
    • 1970-01-01
    • 1970-01-01
    • 2020-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-19
    相关资源
    最近更新 更多