-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Bug report
Describe the bug
When receiving push notification when app killed in ios 17.2.1 the app is crushing when sending push with data and content_available
true
Steps to reproduce
- Send push notification by rest api sample json :
{
"to": "token",
"notification": {
"body": "test 1",
"title": "FCM Message"
},
"content_available": true,
"priority": "high",
"data": {
"link": "fifo_link",
"key2": "value2"
}
}
- push notification displayed immediatly after it the app crush
Error :
0 CoreFoundation 0x1a860a69c __exceptionPreprocess + 164 (NSException.m:249)
1 libobjc.A.dylib 0x1a08bfc80 objc_exception_throw + 60 (objc-exception.mm:356)
2 CoreFoundation 0x1a868f490 +[NSException raise:format:] + 112 (NSException.m:0)
3 FirebaseAuth 0x103558e94 +[FIRAuth auth] + 76 (FIRAuth.m:445)
4 Runner 0x102980f34 -[FLTFirebaseMessagingPlugin application:didReceiveRemoteNotification:fetchCompletionHandler:] + 96 (FLTFirebaseMessagingPlugin.m:446)
5 Flutter 0x10412c8f4 0x104104000 + 166132
6 UIKitCore 0x1ab56f880 -[UIApplication pushRegistry:didReceiveIncomingPushWithPayload:forType:withCompletionHandler:] + 292 (UIApplication.m:14658)
7 PushKit 0x215d724a0 __74-[PKPushRegistry remoteUserNotificationPayloadReceived:completionHandler:]_block_invoke + 128 (PKPushRegistry.m:287)
8 libdispatch.dylib 0x1b05136a8 _dispatch_call_block_and_release + 32 (init.c:1530)
9 libdispatch.dylib 0x1b0515300 _dispatch_client_callout + 20 (object.m:561)
10 libdispatch.dylib 0x1b0523998 _dispatch_main_queue_drain + 984 (queue.c:7813)
11 libdispatch.dylib 0x1b05235b0 _dispatch_main_queue_callback_4CF + 44 (queue.c:7973)
12 CoreFoundation 0x1a855501c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1780)
13 CoreFoundation 0x1a8551d28 __CFRunLoopRun + 1996 (CFRunLoop.c:3149)
14 CoreFoundation 0x1a8551478 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
15 GraphicsServices 0x1ebad24f8 GSEventRunModal + 164 (GSEvent.c:2196)
16 UIKitCore 0x1aa97562c -[UIApplication _run] + 888 (UIApplication.m:3685)
17 UIKitCore 0x1aa974c68 UIApplicationMain + 340 (UIApplication.m:5270)
18 Runner 0x102524be4 main + 64 (AppDelegate.swift:13)
19 dyld
After a long research i discover that when receiving push notification the code like this in file FLTFirebaseAuthPlugin.m
:
#if TARGET_OS_IPHONE
#if !__has_include(<FirebaseMessaging/FirebaseMessaging.h>)
- (BOOL)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)notification
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
if ([[FIRAuth auth] canHandleNotification:notification]) {
completionHandler(UIBackgroundFetchResultNoData);
return YES;
}
return NO;
}
#endif
This lines crushing the app , reason cus firebase not configure cus it only configure at main.dart.
When the app killed and receiving push this code is calling.
for "hack" solution i delete this lines and copy the firebase messaging library.
if ([[FIRAuth auth] canHandleNotification:notification]) {
completionHandler(UIBackgroundFetchResultNoData);
Expected behavior
App should not crushed
Add any other context about the problem here.
Flutter doctor
[✓] Flutter (Channel stable, 3.16.4, on macOS 14.2 23C64 darwin-arm64, locale
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] IntelliJ IDEA Community Edition (version 2021.3.2)
[✓] VS Code (version 1.85.1)
[✓] Connected device (3 available)
flutter dependencies :
firebase_app_check: ^0.2.1+4
firebase_auth: ^4.14.0
firebase_core: ^2.22.0
firebase_dynamic_links: ^5.4.4
firebase_messaging: ^14.7.4
firebase_storage: ^11.5.1