Flutter 应用无法在真实 ios 设备上运行

Flutter app not working on real ios device

Flutter 应用程序在 iOS 模拟器和 android 上完美运行,但在真实的 ios 设备上它会出现白屏错误并且应用程序崩溃

我的 iOS 模拟器日志(有效):

2021-11-24 19:26:47.603717+0300 Runner[30853:260546] Metal API Validation Enabled
2021-11-24 19:26:48.033007+0300 Runner[30853:260546] [Firebase/Crashlytics] Version 8.9.0
2021-11-24 19:26:48.732373+0300 Runner[30853:260869] flutter: Observatory listening on http://127.0.0.1:57092/UvnyfKzFO-k=/
2021-11-24 19:26:49.003635+0300 Runner[30853:260782] [boringssl] boringssl_metrics_log_metric_block_invoke(144) Failed to log metrics
2021-11-24 19:26:49.120389+0300 Runner[30853:260790] 8.9.0 - [Firebase/Messaging][I-FCM002022] APNS device token not set before retrieving FCM Token for Sender ID '721569697388'. Notifications to this FCM Token will not be delivered over APNS.Be sure to re-retrieve the FCM token once the APNS device token is set.
2021-11-24 19:26:49.121098+0300 Runner[30853:260790] 8.9.0 - [Firebase/Analytics][I-ACS023007] Analytics v.8.9.0 started
2021-11-24 19:26:49.122288+0300 Runner[30853:260790] 8.9.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled 
2021-11-24 19:26:49.123287+0300 Runner[30853:260790] 8.9.0 - [Firebase/Analytics][I-ACS025036] App Delegate Proxy is disabled
2021-11-24 19:26:50.825098+0300 Runner[30853:260789] 8.9.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
2021-11-24 19:26:51.214160+0300 Runner[30853:260789] 8.9.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled
2021-11-24 19:26:51.215016+0300 Runner[30853:260789] 8.9.0 - [Firebase/Analytics][I-ACS023220] Analytics screen reporting is enabled. Call +[FIRAnalytics logEventWithName:FIREventScreenView parameters:] to log a screen view event. To disable automatic screen reporting, set the flag FirebaseAutomaticScreenReportingEnabled to NO (boolean) in the Info.plist
2021-11-24 19:26:51.681151+0300 Runner[30853:260891] [boringssl] boringssl_metrics_log_metric_block_invoke(144) Failed to log metrics
2021-11-24 19:26:52.423968+0300 Runner[30853:260792] [boringssl] boringssl_metrics_log_metric_block_invoke(144) Failed to log metrics
2021-11-24 19:26:54.957122+0300 Runner[30853:260546] Writing analzed variants.
2021-11-24 19:26:54.960010+0300 Runner[30853:260546] Writing analzed variants.

我的真实设备日志(iPhone 7,iPhone 7 加):

2021-11-24 19:28:37.480454+0300 Runner[1472:247096] Metal API Validation Enabled
2021-11-24 19:28:37.645543+0300 Runner[1472:247096] [Firebase/Crashlytics] Version 8.9.0
2021-11-24 19:28:37.772118+0300 Runner[1472:247326] [VERBOSE-2:shell.cc(93)] Dart Error: Can't load Kernel binary: Invalid kernel binary format version.
2021-11-24 19:28:37.772214+0300 Runner[1472:247326] [VERBOSE-2:dart_isolate.cc(170)] Could not prepare isolate.
2021-11-24 19:28:37.772511+0300 Runner[1472:247326] [VERBOSE-2:runtime_controller.cc(382)] Could not create root isolate.
2021-11-24 19:28:37.772551+0300 Runner[1472:247326] [VERBOSE-2:shell.cc(576)] Could not launch engine with configuration.
2021-11-24 19:28:37.773459+0300 Runner[1472:247337] flutter: Observatory listening on http://127.0.0.1:63107/l5zqCllUQh8=/
2021-11-24 19:28:37.795951+0300 Runner[1472:247320] 8.9.0 - [Firebase/Analytics][I-ACS023007] Analytics v.8.9.0 started
2021-11-24 19:28:37.796327+0300 Runner[1472:247320] 8.9.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled 
2021-11-24 19:28:37.796769+0300 Runner[1472:247320] 8.9.0 - [Firebase/Analytics][I-ACS025036] App Delegate Proxy is disabled
2021-11-24 19:28:37.813715+0300 Runner[1472:247320] 8.9.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
2021-11-24 19:28:38.110193+0300 Runner[1472:247321] 8.9.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled
2021-11-24 19:28:38.110621+0300 Runner[1472:247321] 8.9.0 - [Firebase/Analytics][I-ACS023220] Analytics screen reporting is enabled. Call +[FIRAnalytics logEventWithName:FIREventScreenView parameters:] to log a screen view event. To disable automatic screen reporting, set the flag FirebaseAutomaticScreenReportingEnabled to NO (boolean) in the Info.plist
2021-11-24 19:28:40.191307+0300 Runner[1472:247322] [connection] nw_resolver_start_query_timer_block_invoke [C1] Query fired: did not receive all answers in time for firebaselogging-pa.googleapis.com:443

颤动医生:

[✓] Flutter (Channel unknown, 2.2.3, on macOS 11.6.1 20G224 darwin-x64, locale tr-TR)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[!] Android Studio (version 2020.3)
    ✗ Unable to find bundled Java version.
[✓] VS Code (version 1.62.3)
[✓] Connected device (4 available)

可能错误日志:

nw_resolver_start_query_timer_block_invoke [C1] Query fired: did not receive all answers in time for firebaselogging-pa.googleapis.com:443

谢谢!

打开Flutter SDK,进入bin/cache删除所有文件然后运行flutter doctor,然后flutter升级