落回到flutter中的模拟器错误,从nsuserdefaults加载访问令牌



我已经厌倦了调试这个问题,但是要确切地说,我找不到任何完美的解决方案。

以前我的应用程序用来表现顺利,没有任何麻烦,但是现在我在登录我的帐户时会遇到此错误

可能的问题:这是firebase问题的东西,但是模拟器无法将accessToken存储在模拟器中。

我遵循以下问题:

  1. 由于模拟器错误
  2. 由于模拟器错误

现在,我的应用程序运行良好,当我尝试登录时会出现问题。我已经看到了解决方案,但是根据上述研究对我没有任何影响。

到目前为止我所做的是:

  1. 重新启动该应用
  2. 重新启动我的系统,并试图运行该应用
  3. 在我的 pubspec.yaml文件中更改了firebase_core和firebase_auth的版本
  4. 重新安装的Xcode。同样的问题
  5. 这是我的pubspec.yaml文件中的flutter firebase包
  • firebase_core: ^0.3.0
  • firebase_auth: ^0.8.0

与所有这些,一切都没有解决。错误似乎是一致的。

登录代码:

final AuthCredential credential = EmailAuthProvider.getCredential(email: this.email.text, password: this.password.text);
this._auth.signInWithCredential(credential).then((user) async {
}, onError: (e){
   Helpers.showError(context, (e as PlatformException).message);
});

错误:

1。首次运行应用程序时:

Launching lib/main.dart on iPhone 7 in debug mode...
Running Xcode build...                                                  
                                                   
 ├─Assembling Flutter resources...                           4.1s
 └─Compiling, linking and signing...                         7.0s
Xcode build done.                                           14.5s
Configuring the default Firebase app...
5.20.0 - [Firebase/Core][I-COR000004] App with name __FIRAPP_DEFAULT does not exist.
Configured the default Firebase app __FIRAPP_DEFAULT.
Falling back to loading access token from NSUserDefaults because of simulator bug
Falling back to storing access token in NSUserDefaults because of simulator bug
Falling back to loading access token from NSUserDefaults because of simulator bug
Falling back to storing access token in NSUserDefaults because of simulator bug
Falling back to loading access token from NSUserDefaults because of simulator bug
Falling back to storing access token in NSUserDefaults because of simulator bug
5.20.0 - [Firebase/Analytics][I-ACS023007] Analytics v.50801000 started
5.20.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled
flutter: in the main builder
flutter: in the init page state                                         
flutter: building the init page                                         
    "LocalUploadTask <A98F1971-4A48-4CDD-8658-567C6E24AE0E>.<1>"        
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalUploadTask <A98F1971-4A48-4CDD-8658-567C6E24AE0E>.<1>, NSLocalizedDescription=cancelled} [-999]
<Google/Utilities/Network/ERROR> Encounter network error. Code, error: -999, Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://play.googleapis.com/log, NSErrorFailingURLKey=https://play.googleapis.com/log, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalUploadTask <A98F1971-4A48-4CDD-8658-567C6E24AE0E>.<1>"        
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalUploadTask <A98F1971-4A48-4CDD-8658-567C6E24AE0E>.<1>, NSLocalizedDescription=cancelled}
5.20.0 - [GULNetwork][I-NET901017] <Google/Utilities/Network/ERROR> Encounter network error. Code, error: -999, Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://play.googleapis.com/log, NSErrorFailingURLKey=https://play.googleapis.com/log, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalUploadTask <A98F1971-4A48-4CDD-8658-567C6E24AE0E>.<1>"        
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalUploadTask <A98F1971-4A48-4CDD-8658-567C6E24AE0E>.<1>, NSLocalizedDescription=cancelled}
        [C3.1.1 06A394ED-7FAF-45F0-ACCA-755A5E942EB5 ::1.56091<->::1.8080]
        Connected Path: satisfied (Path is satisfied), interface: lo0   
        Duration: 1.659s, DNS @0.005s took 0.013s, TCP @0.038s took 0.001s, TLS took 0.316s
        bytes in/out: 3907/808, packets in/out: 10/9, rtt: 0.000s, retransmitted packets: 0, out-of-order packets: 0
                                                                        
                                                                        
Your Facebook SDK is out of date. We recommend upgrading to the latest Version 4.37.0, to ensure your app's performance is not affected and to take advantage of our newest features!
                                                                        
Facebook SDK for iOS: https://developers.facebook.com/docs/ios/         
Facebook SDK for Android: https://developers.facebook.com/docs/android/ 
        [C2.1.1 D009F134-D0FD-41DF-BCB2-713CBD8875DF ::1.56090<->::1.8080]
        Connected Path: satisfied (Path is satisfied), interface: lo0   
        Duration: 1.729s, DNS @0.005s took 0.023s, TCP @0.037s took 0.014s, TLS took 0.295s
        bytes in/out: 4353/1054, packets in/out: 10/9, rtt: 0.000s, retransmitted packets: 0, out-of-order packets: 0
5.20.0 - [Firebase/Core][I-COR000020] Error posting to Clearcut: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://play.googleapis.com/log, NSErrorFailingURLKey=https://play.googleapis.com/log, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalUploadTask <A98F1971-4A48-4CDD-8658-567C6E24AE0E>.<1>"        
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalUploadTask <A98F1971-4A48-4CDD-8658-567C6E24AE0E>.<1>, NSLocalizedDescription=cancelled}, with Status Code: 0
flutter: building the init page                                         
flutter: building the init page                                         
        [C4.1.1 09BF4681-8112-4F65-84AA-824DC0C0F7A3 ::1.56101<->::1.8080]
        Connected Path: satisfied (Path is satisfied), interface: lo0   
        Duration: 0.622s, DNS @0.003s took 0.002s, TCP @0.020s took 0.001s, TLS took 0.148s
        bytes in/out: 3761/1543, packets in/out: 9/10, rtt: 0.000s, retransmitted packets: 0, out-of-order packets: 0
flutter: Calling GET API: /init                                         
Syncing files to device iPhone 7...                                     
flutter: {token: null, is_user_active: false, user: null}       
Syncing files to device iPhone 7...                                                          4,586ms (!)

2。当我尝试登录时:

Challenge SecTrustResultType 5 for www.googleapis.com, properties: (
        {
        type = error;
        value = "Root certificate is not trusted.";
    }
)
Cancelling authentication challenge for https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPassword?key=XXXXXXXXXXXXXXXXXXXXXX
    "LocalDataTask <A48A2557-0E1B-4F61-8E54-B319538559DA>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <A48A2557-0E1B-4F61-8E54-B319538559DA>.<1>, NSLocalizedDescription=cancelled} [-999]

3。射击:

Network error (such as timeout, interrupted connection or unreachable host) has occurred

flutter医生:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v1.7.9-pre.9, on Mac OS X 10.14.5 18F132, locale en-US)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 10.0)
[✓] iOS tools - develop for iOS devices
[✓] Chrome - develop for the web
[!] Android Studio (version 3.4)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] Connected device (3 available)
! Doctor found issues in 1 category.

接下来我可以尝试什么?

以来,这是一个错误,我们大多数人都不知道,所以我决定自己写它,因为我找到了解决方案。它去了。

我已经尝试了很多事情,但是我的团队弄清楚了一些东西,也就是说,firebase包装版本有一些东西。我所做的是:

  1. 完全做一个新项目
  2. 将其连接到Firebase
  3. 使用当前版本firebase_auth 0.8.3
  4. 运行该项目,并确保您的登录工作
  5. 完成后,运行旧项目并看到它可以工作。

可能性是包装通常存储在所有项目的同一文件中,因此cat .packages会为您提供想法。

谢谢,学习快乐!!

最新更新