问题描述
在展示应用程序的Home View控制器之前,我想检查用户是否仍然具有有效的会话.我使用最新的Firebase API.我想如果我使用旧版软件,我就能知道这一点.
I wanna check if the user has still a valid session, before I present the Home View controller of my app. I use the latest Firebase API. I think if I use the legacy, I'll be able to know this.
这是我到目前为止所做的:
Here's what I did so far:
-
我在Firebase的Slack社区上发布了我的问题,没有人回答.我找到了这个,但这是针对Android的: https: //groups.google.com/forum/?hl=el#!topic/firebase-talk/4HdhDvVRqHc
我尝试阅读iOS版Firebase的文档,但似乎无法理解: https://firebase.google.com/docs/reference/ios/firebaseauth/interface_f_i_r_auth
I tried reading the docs of Firebase for iOS, but I can't seem to comprehend it: https://firebase.google.com/docs/reference/ios/firebaseauth/interface_f_i_r_auth
我尝试这样输入Xcode:
I tried typing in Xcode like this:
FIRApp().currentUser()
FIRUser().getCurrentUser()
但是我似乎找不到该getCurrentUser函数.
But I can't seem to find that getCurrentUser function.
推荐答案
if FIRAuth.auth().currentUser != nil {
presentHome()
} else {
//User Not logged in
}
对于更新的SDK
if Auth.auth().currentUser != nil {
}
这篇关于如何检查用户是否具有有效的Auth Session Firebase iOS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!