Firebase - iOS Swift: FIRAuth.auth().signOut() not signing out current user

后端 未结 6 1296
栀梦
栀梦 2020-12-18 04:24

I\'m building an app using Firebase with an initial SignInViewController that loads a sign in page for users to authenticate with email which triggers the follo

6条回答
  •  太阳男子
    2020-12-18 05:30

    I just had what I think is the same problem - Firebase + Swift 3 wouldn't trigger stateDidChangeListeners on logout, which left my app thinking the user was still logged in.

    What ended up working for me was to save and reuse a single reference to the FIRAuth.auth() instance rather than calling FIRAuth.auth() each time.

    Calling FIRAuth.auth()?.signOut() would not trigger stateDidChangeListeners that I had previously attached. But when I saved the variable and reused it in both methods, it worked as expected.

提交回复
热议问题