繁体   English   中英

NSInvalidArgumentException',原因:'-[NSNull 长度]:无法识别的选择器发送到实例

[英]NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance

我的 Flutter 应用程序已更新到最新版本的 Flutter 并且我将 firebase_messaging 添加到我的应用程序中。 完成此操作后,此应用程序在模拟器上运行良好,但当我尝试在实际 iOS 设备上运行它时崩溃,出现以下错误:

  -[NSNull length]: unrecognized selector sent to instance 0x1ddcb9ee0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance 0x1ddcb9ee0'
*** First throw call stack:
(0x18c8959d8 0x1a0bfeb54 0x18c7a5bbc 0x18c89801c 0x18c899f8c 0x102deadcc 0x102dec698 0x102deb1a8 0x102dea8bc 0x18c4cd298 0x18c4ce280 0x18c4aa4f0 0x18c4aafdc 0x18c4b4800 0x1d4f3b5a4 0x1d4f3e874)
libc++abi.dylib: terminating with uncaught exception of type NSException
* thread #5, queue = 'com.google.firebase.auth.globalWorkQueue', stop reason = signal SIGABRT
    frame #0: 0x00000001b86f484c libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
->  0x1b86f484c <+8>:  b.lo   0x1b86f4868               ; <+36>
    0x1b86f4850 <+12>: stp    x29, x30, [sp, #-0x10]!
    0x1b86f4854 <+16>: mov    x29, sp
    0x1b86f4858 <+20>: bl     0x1b86d1f5c               ; cerror_nocancel
Target 0: (Runner) stopped.

我已经尝试了一切,从从应用程序中删除消息到检查是否在 Xcode 中启用了“推送通知”和“后台获取”,但应用程序仍然不断崩溃。 错误日志显示崩溃来自firebase.auth.globalWorkQueue并且应用程序在模拟器上启动得很好。 我删除了 firebase_messaging 并且应用程序在模拟器上运行时仍然崩溃。 任何建议将不胜感激。

因此,经过大约一周的不眠之夜,改组依赖项、降级、升级软件包和版本,结果发现问题出在我的 flutter 代码上。 随着 null 安全更改。 Pushing a null value to the native Firebase SDK causes a crash rather than an error and I was getting unchecked null values from my shared preferences. 我预计我的代码中会出现错误,但是发生了崩溃,所以它一直在中断。 如果您在代码中看到上述错误,您可能会将 null 值推送到 function 中的符号中。 检查

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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