简体   繁体   中英

fluttrer Firebase authStateChanges doesn't get triggered

Updated my MacBook Pro M1 to Big Sur 11.3 , iOS simulator was updated to 14.5

Now my Flutter project, which is using Firebase auth and used to work just fine, is showing chaotic authentication behaviour, both on simulator and iOS device (both iOS 14.5):

  1. I login as UserA, authStateChanges doesn't trigger
  2. I login as UserB, authStateChanges gets triggered - everything works just fine
  3. I restart the app (VSCode) and I find myself back in the login screen, since authStateChanges returns null (firebaseUser = null, see code)

Tested firebase_auth: ^1.0.0 and firebase_auth: ^1.1.2

Sample code (used to work just fine):

FirebaseAuth.instance.authStateChanges().listen((User firebaseUser) {
// if null goto login screen, otherwise goto user screen
});

Downloading iOS 14.4 Simulator - in order to test my app on it...

UPDATE: So I see the same behavior with iOS 14.4 Simulator. Is it possible that something has changed with my Firebase auth settings? What can cause this?

UPDATE 2: Tested on my iPhone, in release mode, and I see the same behavior: After killing my app, I find myself back in the login screen... So it's obviously a new compiled version that causes this, but I have no idea what it is...

UPDATE 3: Just reverted to a 2 weeks old version of my code, still the same issue, So I'm starting to think that's not a code issue, but rather a Mac configuration issue - maybe Big Sur 11.3 , maybe the new Flutter version ( 2.0.5 ) Very frustrating...

Actually, there is already an open issue for that: https://github.com/FirebaseExtended/flutterfire/issues/5952

If I use old versions, it works for me:

firebase_core: 1.0.4
firebase_auth: 1.1.1

Then you have to do:

flutter clean 
pod deintegrate
rm Podfile.lock
pod cache clean --all
flutter run

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM