首页 > 解决方案 > Flutter 应用程序在 iOS 14.4 及更高版本上不断崩溃

问题描述

我正面临严重影响,因为我的 Flutter 应用程序正在 Android 物理设备、Android 模拟器、iOS 模拟器(iOS 14.4)上运行,并且在从 firebase 获取数据后 5 秒后iOS 真实设备上崩溃

  1. 它以前运行良好,我没有对其进行任何更改,但它现在开始崩溃。

  2. 我试图将更改恢复到以前的工作版本,但它也崩溃了。

颤振医生

[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5.1 20G80 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[!] Android Studio (version 2020.3)
    ✗ Unable to find bundled Java version.
[✓] IntelliJ IDEA Ultimate Edition (version 2020.2.3)
[✓] VS Code (version 1.56.0)
[✓] Connected device (2 available)

发布规范.yaml

name: aflex
description: A Community-Based On-Demand Services Marketplace Connecting Customers to Interior Designers in Malaysia.

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.3.1+86
environment:
  sdk: '>=2.3.0 <3.0.0'

dependencies:
  flutter:
    sdk: flutter
  google_maps_flutter: ^2.0.2
  flutter_datetime_picker:
    git:
      url: https://github.com/Realank/flutter_datetime_picker.git
      ref: master
  flutter_svg: ^0.22.0
  firebase_core: 1.4.0
  form_field_validator: ^1.0.1
  flutter_form_builder: ^6.0.0-nullsafety.1
  smooth_star_rating: ^1.1.1
  cloud_firestore: ^2.4.0
  cloud_functions: ^3.0.0
  firebase_auth: ^3.0.1
  sailor: ^0.7.1
  scoped_model: ^1.0.1
  google_fonts: ^2.0.0
  outline_material_icons: ^0.1.1
  material_design_icons_flutter: ^4.0.5555
  firebase_helpers: ^0.4.0
  shared_preferences: ^2.0.6
  carousel_slider: ^4.0.0
  date_format: ^2.0.2
  cached_network_image: ^3.0.0
  image_picker: ^0.8.2
  location: ^4.1.1
  date_time_format: ^2.0.1
  firebase_storage: ^8.0.1
  geocoder: ^0.2.1
  firebase_messaging: ^10.0.3
  map_launcher: ^2.1.1
  geolocator: ^7.0.1
  flappy_search_bar: ^1.7.2
  hexcolor: ^2.0.3
  flutter_local_notifications: ^8.0.0
  fluttertoast: ^8.0.3
  photo_view: ^0.12.0
  rating_dialog: ^2.0.0
  universal_platform: ^1.0.0+1
  simple_animations: ^3.0.3
  flutter_spinkit: ^5.0.0
  file_picker: ^3.0.0
  progress_dialog: ^1.2.0
  image_cropper: ^1.3.1
  url_launcher: ^6.0.3
  expandable: ^5.0.1
  pull_to_refresh: ^2.0.0
  connectivity: ^3.0.3
  bloc: ^7.0.0
  flutter_bloc: ^7.0.0
  flutter_staggered_grid_view: ^0.3.3
  audioplayers: ^0.19.1
  stripe_payment: ^1.1.4
  firebase_dynamic_links: ^2.0.7
  flutter_slidable: ^0.6.0
  provider: ^5.0.0
  badges: ^2.0.1
  in_app_review: ^2.0.1
  google_mobile_ads: ^0.13.3
  flutter_app_badger: ^1.2.0
  mailer2: ^1.2.5
  firebase_crashlytics: ^2.0.2
  notification_permissions: ^0.5.0
  flutter_absolute_path: ^1.0.6
  like_button: ^2.0.2
  showcaseview: ^1.1.0


dev_dependencies:
  flutter_launcher_icons: ^0.9.0

flutter:
  uses-material-design: true
  assets:
    - assets/images/
    - assets/icons/
    - assets/flags/
    - assets/mp3/

flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/icons/aflex_logo.png"

这是我使用真实设备在 android studio 上运行时的崩溃日志

(lldb) 2021-08-10 17:27:07.021437+0100 Runner[28299:11146108] 8.3.0 - [Firebase/Core][I-COR000005] No app has been configured yet.
8.3.0 - [Firebase/Messaging][I-FCM002022] APNS device token not set before retrieving FCM Token for Sender ID '732109847689'. 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.
8.3.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
[connection] nw_endpoint_handler_set_adaptive_read_handler [C1.1.1 74.125.193.95:443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, dns)] unregister notification for read_timeout failed
[connection] nw_endpoint_handler_set_adaptive_write_handler [C1.1.1 74.125.193.95:443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, dns)] unregister notification for write_timeout failed
WF: === Starting WebFilter logging for process Runner
WF: _userSettingsForUser mobile: {
    filterBlacklist =     (
    );
    filterWhitelist =     (
    );
    restrictWeb = 1;
    useContentFilter = 0;
    useContentFilterOverrides = 0;
    whitelistEnabled = 0;
}
WF: _WebFilterIsActive returning: NO
[Firebase/Crashlytics] Version 8.3.0
[VERBOSE-2:shell.cc(93)] Dart Error: Can't load Kernel binary: Invalid kernel binary format version.
[VERBOSE-2:dart_isolate.cc(170)] Could not prepare isolate.
[VERBOSE-2:runtime_controller.cc(382)] Could not create root isolate.
[VERBOSE-2:shell.cc(576)] Could not launch engine with configuration.
[connection] nw_endpoint_handler_set_adaptive_read_handler [C2.1.1 74.125.193.94:443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, dns)] unregister notification for read_timeout failed
[connection] nw_endpoint_handler_set_adaptive_write_handler [C2.1.1 74.125.193.94:443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, dns)] unregister notification for write_timeout failed
[connection] nw_endpoint_handler_set_adaptive_read_handler [C3.1.1 74.125.193.95:443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, dns)] unregister notification for read_timeout failed
[connection] nw_endpoint_handler_set_adaptive_write_handler [C3.1.1 74.125.193.95:443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, dns)] unregister notification for write_timeout failed
[connection] nw_endpoint_handler_set_adaptive_read_handler [C4.1.1 74.125.193.95:443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, dns)] unregister notification for read_timeout failed
[connection] nw_endpoint_handler_set_adaptive_write_handler [C4.1.1 74.125.193.95:443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, dns)] unregister notification for write_timeout failed
8.3.0 - <AppMeasurement>[I-ACS025027] Deferring to Google Analytics for Firebase for event data collection. 
[connection] nw_endpoint_handler_set_adaptive_read_handler [C5.1.1 74.125.193.95:443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, dns)] unregister notification for read_timeout failed
[connection] nw_endpoint_handler_set_adaptive_write_handler [C5.1.1 74.125.193.95:443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, dns)] unregister notification for write_timeout failed

这是我在 iPhone 12 Pro max 模拟器上使用 Xcode 运行时的崩溃日志

2021-08-10 17:12:15.277633+0100 Runner[87679:679604] Metal API Validation Enabled
2021-08-10 17:12:15.334577+0100 Runner[87679:679604] [Firebase/Crashlytics] Version 8.3.0
2021-08-10 17:12:15.343561+0100 Runner[87679:679825] 8.3.0 - [Firebase/Core][I-COR000005] No app has been configured yet.
2021-08-10 17:12:15.344198+0100 Runner[87679:679825] 8.3.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
2021-08-10 17:12:15.373466+0100 Runner[87679:679965] flutter: Observatory listening on http://127.0.0.1:58955/nSXEmPeyWzc=/
2021-08-10 17:12:15.952848+0100 Runner[87679:679826] 8.3.0 - <AppMeasurement>[I-ACS025027] Deferring to Google Analytics for Firebase for event data collection. 
2021-08-10 17:12:15.959014+0100 Runner[87679:679806] [Client] Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}
2021-08-10 17:12:15.959200+0100 Runner[87679:679826] [Client] Synchronous remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}
2021-08-10 17:12:15.959672+0100 Runner[87679:679826] [Client] Synchronous remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}
2021-08-10 17:12:15.959780+0100 Runner[87679:679806] [Client] Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}
2021-08-10 17:12:15.960313+0100 Runner[87679:679826] [Client] Synchronous remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}
2021-08-10 17:12:15.960427+0100 Runner[87679:679806] [Client] Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}
2021-08-10 17:12:15.963161+0100 Runner[87679:679806] [Client] Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}
2021-08-10 17:12:15.963302+0100 Runner[87679:679806] [Client] Updating selectors after delegate addition failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}
2021-08-10 17:12:15.964322+0100 Runner[87679:679825] [] nw_protocol_get_quic_image_block_invoke dlopen libquic failed
2021-08-10 17:12:15.993368+0100 Runner[87679:679826] 8.3.0 - [Firebase/Messaging][I-FCM012002] Error in application:didFailToRegisterForRemoteNotificationsWithError: remote notifications are not supported in the simulator
2021-08-10 17:12:15.993545+0100 Runner[87679:679826] 8.3.0 - [Firebase/Messaging][I-FCM002022] APNS device token not set before retrieving FCM Token for Sender ID '732109847689'. 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-08-10 17:12:16.111430+0100 Runner[87679:679604] [TraitCollection] Class CKBrowserSwitcherViewController overrides the -traitCollection getter, which is not supported. If you're trying to override traits, you must use the appropriate API.
2021-08-10 17:12:16.451663+0100 Runner[87679:679604] WF: === Starting WebFilter logging for process Runner
2021-08-10 17:12:16.451917+0100 Runner[87679:679604] WF: _WebFilterIsActive returning: NO
2021-08-10 17:12:16.668573+0100 Runner[87679:679604] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600001a148e0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
[Crashlytics] The signal SIGABRT has a non-Crashlytics handler (GADRegisterSignalHandlers).  This will interfere with reporting.
[Crashlytics] The signal SIGBUS has a non-Crashlytics handler (GADRegisterSignalHandlers).  This will interfere with reporting.
[Crashlytics] The signal SIGFPE has a non-Crashlytics handler (GADRegisterSignalHandlers).  This will interfere with reporting.
[Crashlytics] The signal SIGILL has a non-Crashlytics handler (GADRegisterSignalHandlers).  This will interfere with reporting.
[Crashlytics] The signal SIGSEGV has a non-Crashlytics handler (GADRegisterSignalHandlers).  This will interfere with reporting.
[Crashlytics] The signal SIGSYS has a non-Crashlytics handler (GADRegisterSignalHandlers).  This will interfere with reporting.
[Crashlytics] The signal SIGTRAP has a non-Crashlytics handler (GADRegisterSignalHandlers).  This will interfere with reporting.
2021-08-10 17:12:17.543491+0100 Runner[87679:679826] 8.3.0 - [Firebase/Crashlytics][I-CLS000000] Warning: NSUncaughtExceptionHandler is 'GADRegisterExceptionHandler' in '/Users/charles/Library/Developer/CoreSimulator/Devices/48A1C187-055D-4DD0-81D8-437B2D765A75/data/Containers/Bundle/Application/8EA150E6-3D9E-4ECC-B46F-FD766B6E40B2/Runner.app/Runner'
2021-08-10 17:12:23.411310+0100 Runner[87679:679946] -[MTLDebugDevice newBufferWithLength:options:], line 620: error 'Buffer Validation
newBufferWith*:length 0x18000000 must not exceed 256 MB.
'
-[MTLDebugDevice newBufferWithLength:options:]:620: failed assertion `Buffer Validation
newBufferWith*:length 0x18000000 must not exceed 256 MB.
'

appDelegate.swift

 import UIKit
import Flutter
import GoogleMaps

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GMSServices.provideAPIKey("AIzaSyCTaYh3j4-AIzaSyBM2XQKSXUKcr0PxyCpZzIRgD0dPEsG97g")
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

我相信在运行发布版本时 Xcode 上的设置有问题,因为它在 iPhone 12 Pro max 模拟器上运行良好。

我想知道是否有人面临同样的问题并有解决方案?

标签: iosfirebaseflutter

解决方案


这个问题已经解决了,罪魁祸首是因为在我的主页上同时加载了大量图像并且内存密集,这就是我收到错误“停止原因= EXC_RESOURCE RESOURCE_TYPE_MEMORY”的原因,我解决了通过使用 optimised_cached_image ( https://pub.dev/packages/optimized_cached_image ) 来减小图像大小,一切都恢复正常了!


推荐阅读