首页 > 解决方案 > Flutter Firebase_messaging onBackgroundMessage 不会在较旧的 ios 设备上调用(iPhone 7 iPhone 8)

问题描述

我们在 Flutter 应用程序中使用 firebase_messaging ^9.1.1。当应用程序处于后台或终止状态时,在“iPhone se”中调用 onBackgroundMessage。但不是在 iPhone 7 或 iPhone 8 上调用。所有设备的 IOS 版本相同,即 IOS 14.4.2。

我们在 onBackgroundMessage 中调用 callkeep: ^0.2.3+1 插件。当应用程序终止/在后台接收通知(iPhone 7 或 iPhone 8)时,我们看不到呼叫 UI。

这是我们的代码:

void main() async {
FirebaseMessaging.onBackgroundMessage(myBackgroundMessageHandler);

WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
if (!UniversalPlatform.isWeb) {
PushNotificationsManager().initCallKit();
}
Future<dynamic> myBackgroundMessageHandler(RemoteMessage message) async {
await Firebase.initializeApp();
//callkeep: ^0.2.3+1 plugin. code here.
}

Have anyone faced this issue? what next we can try to solve this issue?

标签: iosfirebaseflutterfirebase-cloud-messagingcallkit

解决方案


推荐阅读