iosflutterfirebasepush-notificationurbanairship.com

Flutter App crashes on iOS after receiving push notification from Airship


We are recently experiencing app crashes only on iOS (on Android it works fine) after receiving and/or clicking push notification from Airship with Flutter.

The error we're getting looks like this:

-[__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

Dependencies in 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

Solution

  • The problem was with the firebase_messaging dependency, after removing it the code works.