Flutter App 在模拟器(Iphone 12 mini)上完美运行,但在设备上崩溃(Iphone 8 plus)

Posted

技术标签:

【中文标题】Flutter App 在模拟器(Iphone 12 mini)上完美运行,但在设备上崩溃(Iphone 8 plus)【英文标题】:Flutter App works perfectly on simulator (Iphone 12 mini) but crashes on device (Iphone 8 plus) 【发布时间】:2021-05-02 07:09:47 【问题描述】:

我在模拟器上运行我的应用程序,它运行良好,但是当我尝试在我的设备上运行它时,我得到了一堆错误:

(lldb) 2021-05-02 00:01:22.562844-0700 Runner[27185:7965723] 7.3.0 - [Firebase/Core][I-COR000005] No app has been configured yet.
7.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.                                           
-[__NSSingleEntryDictionaryI setObject:forKeyedSubscript:]: unrecognized selector sent to instance 0x28014d880
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSSingleEntryDictionaryI setObject:forKeyedSubscript:]: unrecognized selector sent to instance 0x28014d880'
*** First throw call stack:                                             
(0x1a2c85114 0x1b64abcb4 0x1a2b959b8 0x1a2c87758 0x1a2c896cc 0x10793b9a8 0x1a3e5d6e0 0x1a3fc5344 0x1a3fc69fc 0x1a3e5d944 0x1a3e64b28 0x1a3e64740 0x10793b82c 0x105626470 0x105626164 0x1a28bd298 0x1a28be280 0x1a289a4fc 0x1a289afe8 0x1a28a4808 0x1e85685a4 0x1e856b874)
libc++abi.dylib: terminating with uncaught exception of type NSException
* thread #3, queue = 'com.google.FIRCoreDiagnostics', stop reason = signal SIGABRT
    frame #0: 0x00000001cd5fb95c libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:                                  
->  0x1cd5fb95c <+8>:  b.lo   0x1cd5fb978               ; <+36>         
    0x1cd5fb960 <+12>: stp    x29, x30, [sp, #-0x10]!                   
    0x1cd5fb964 <+16>: mov    x29, sp                                   
    0x1cd5fb968 <+20>: bl     0x1cd5d91dc               ; cerror_nocancel
Target 0: (Runner) stopped.

这是我的应用程序的依赖项:

version: 1.0.0+1

environment:
  sdk: ">=2.2.2 <3.0.0"

dependencies:
  flutter:
    sdk: flutter



  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  firebase_core: ^1.0.4
  cupertino_icons: ^1.0.2
  firebase_auth: ^1.1.1
  firebase_database: ^6.0.0
  cloud_firestore: ^1.0.6
  google_maps_flutter: ^2.0.3
  geolocator: ^7.0.3
  intl: ^0.17.0
  firebase_storage: ^8.0.0-1.0.nullsafety.1
  firebase_messaging: ^9.1.2
  cloud_functions: ^1.0.4
  image_cropper: 1.2.1
  image_picker: ^0.7.4
  geoflutterfire: ^3.0.0-nullsafety.2
  location: ^4.1.1
  flutter_cache_manager: ^3.0.1
  bordered_text: ^1.0.1
  maps_launcher: ^2.0.0
  wechat_assets_picker: ^5.1.3
  flutter_google_places: ^0.3.0
  uuid: ^3.0.4

我试过flutter clean,但没有运气。 任何帮助或建议都会很棒!

【问题讨论】:

may be this will help you 您是否启用了后台模式并通过 xcode 推送通知? 您是否获得了互联网许可? 【参考方案1】:

删除 Podfile.lock 然后flutter run

【讨论】:

以上是关于Flutter App 在模拟器(Iphone 12 mini)上完美运行,但在设备上崩溃(Iphone 8 plus)的主要内容,如果未能解决你的问题,请参考以下文章

找不到“Frameworks/App.framework/flutter_assets”的资产路径

启动键盘时 Flutter App 冻结

iOS - 无法在真实设备 iPhone 11 中运行 Flutter 应用程序。iOS - 15.2,Xcode 13.2.1,它在模拟器中工作

如何选择 iPhone 模拟器模型在 Visual Studio Code 上调试 Flutter 应用程序?

尝试运行并构建到 iPhone 模拟器时出现 Flutter Xcode 致命错误

Flutter Run 不工作,在 iPhone 上启动应用程序时出错