Simon Bengtsson Simon Bengtsson - 13 days ago 6
Swift Question

Users logged out on every app start after update to ios 10

After updating to ios 10 some users report that they have to login every time they open the app. After researching the issue the reason was that

FirebaseAuth.auth()?.currentUser
was
nil
so the credentials were not persisted after app restart for some reason. We have also tried using
addAuthStateDidChangeListener
, but it also returns
nil
for those users. Has someone had this problem themselves or know of a way to solve it?

We are using swift 3 and xcode 8 in our project and the issue is appearing both for users logging in with facebook and email.

One workaround is to logout manually with
try? FirebaseAuth.auth()?.signOut()
. It only works if the user is already logged in however so it is not really an optimal solution.

Answer

Our issue was probably related to that we had different bundle ids in the firebase console and for the app. We ended manually logging out all users once to update the bundle id and things have been working every since.