firebase Flutter App在收到Airship的推送通知后在iOS上崩溃

t0ybt7op  于 2023-08-07  发布在  Flutter
关注(0)|答案(2)|浏览(135)

我们最近只在iOS上遇到应用程序崩溃(在Android上运行正常),因为我们收到和/或点击了Airship with Flutter的推送通知。
我们得到的错误看起来像这样:

-[__NSCFType userNotificationCenter:willPresentNotification:withCompletionHandler:]: unrecognized selector sent to instance 0x283cad3b0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType userNotificationCenter:willPresentNotification:withCompletionHandler:]: unrecognized selector sent to instance 0x283cad3b0'
*** First throw call stack:
(0x198f30cb4 0x191fd83d0 0x1990a5ab8 0x198f470e8 0x198fad900 0x102d66fc0 0x10456016c 0x102d66fc0 0x10456016c 0x103445300 0x1034437e4 0x19b39116c 0x19b1a04bc 0x19b1a0260 0x19b1a00a0 0x1aefa1a04 0x1aefa1840 0x1aefa505c 0x1aefa4f78 0x1a03f6eac 0x1a03fa91c 0x1aefaf188 0x1aefaed24 0x1aefb15d0 0x198ffa128 0x1990067b4 0x198f8b5e8 0x198fa10d4 0x198fa63ec 0x1d446b35c 0x19b3336e8 0x19b33334c 0x102ca5808 0x1b84a6dec)
libc++abi: terminating due to uncaught exception of type NSException
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00000001d7e9a558 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`:
->  0x1d7e9a558 <+8>:  b.lo   0x1d7e9a578               ; <+40>
    0x1d7e9a55c <+12>: pacibsp 
    0x1d7e9a560 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1d7e9a564 <+20>: mov    x29, sp

字符串
pubspec.yaml中的依赖项:

dependencies:
  airship_flutter: ^6.3.0
  firebase_analytics: ^10.4.1
  firebase_core: ^2.13.0
  firebase_crashlytics: ^3.3.1
  firebase_messaging: ^14.6.1
  flutter:
    sdk: flutter
  flutter_bloc: ^8.1.2
  flutter_localizations:
    sdk: flutter
  intl: ^0.17.0

lx0bsm1f

lx0bsm1f1#

问题出在firebase_messaging依赖项上,在删除它之后,代码可以正常工作。

bcs8qyzn

bcs8qyzn2#

AppDelegate.swift中删除以下代码修复了该问题。

if #available(iOS 10.0, *) {
  UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}

字符串

相关问题