首页 文章

注销Firebase无法正常工作

提问于
浏览
2

我对我的应用程序中的错误感到疯狂 . 我使用新的Firebase来验证用户Firebase数据库

2种注册/签名方式:电子邮件或Facebook .

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

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

工作良好 .

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

  • 使用Facebook登录

  • 将数据添加到我的应用程序(firebase数据库)

  • 退出

  • 使用不同于Facebook使用的电子邮件帐户登录

我检索与我的 Profiles 帐户完全相同的数据 . 就好像我没有真正退出

我必须在注销后杀死应用程序,以获得与我使用的帐户相对应的数据 .

你有什么主意吗 ?当我杀死app任务时发生了什么?

非常感谢您的回答 .

2 回答

  • 0

    我之前处理过同样的问题,问题是当你退出firebase时你也必须注销facebook .

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

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

  • 0

    感谢贾斯汀,但不幸的是,这与您的解决方案完全相同 . 也许我在AppDelegate上出错了,在那里我检查用户离开App时是否已连接:

    //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
            }
        })   
    }
    

相关问题