【问题标题】:Logout Firebase doesn't really work注销 Firebase 并没有真正起作用
【发布时间】:2016-12-25 11:38:43
【问题描述】:

我被我的应用程序上的一个错误弄疯了。 我使用新的 Firebase 来验证用户 + Firebase DB

2 种注册/登录方式:电子邮件或 Facebook。

在我的应用程序中,我有一个带有简单命令的注销按钮:

    try! FIRAUTH.auth()!.signOut()
self.performSegueWithIdentifier("firstScreen", sender: self)

工作正常。

在同一部 iPhone 上,我的测试:

  • 用 Facebook 登录
  • 将数据添加到我的应用(firebase 数据库)
  • 注销
  • 使用与 Facebook 使用的电子邮件不同的电子邮件帐户登录

我检索到与我的个人资料帐户完全相同的数据。 就像我没有真正注销一样。

我必须在注销后终止应用程序才能获得与我使用的帐户相对应的数据。

你有什么想法吗? 当我杀死应用程序任务时到底发生了什么?

非常感谢您的回答。

【问题讨论】:

    标签: firebase swift2 logout firebase-authentication


    【解决方案1】:

    我之前处理过同样的问题,问题是当您退出 firebase 时,您还必须退出 facebook。

    try! FIRAUTH.auth()!.signOut()
    let loginManager = FBSDKLoginManager()
    loginManager.logOut()
    self.performSegueWithIdentifier("firstScreen", sender: self)
    

    如果您不这样做,您将在登录时继续获取相同的数据。

    【讨论】:

      【解决方案2】:

      感谢贾斯汀,但不幸的是,您的解决方案存在完全相同的问题。 也许我在 AppDelegate 上错了,我在其中检查用户在离开应用程序时是否已连接:

      //check if user has a currentUser ID
      //if Yes, we check if he has a username
      //if Yes, he goes to vc (first viewcontroller)
      //if not, he geos to the vc2 where he chooses a username
      
      if ((FIRAuth.auth()!.currentUser) != nil){
      userID = String(FIRAuth.auth()!.currentUser!.uid)
        ref.child("Users").child(userID).child("name").observeSingleEventOfType(FIRDataEventType.Value, withBlock: { (snapshot) in
              if (snapshot.value as? String == ""){
                 self.window?.rootViewController = vc2
              }else{
                 self.window?.rootViewController = vc
              }
          })   
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-08-05
        • 2012-01-13
        • 1970-01-01
        • 2014-09-14
        • 1970-01-01
        相关资源
        最近更新 更多