我正在将flutter框架与firebase消息传递插件一起使用以启用推送通知。在 Debug模式下编译flutter应用程序时,Firebase消息传递在iOS上正常工作。我还没有在Android上尝试过。但是当我在 Release模式下编译时,没有推送通知出现。在Firebase中,我尚未填写app-name和store-id,因为该应用程序尚未在Apple AppStore中发布。可能是问题所在吗?

最佳答案

也有这个问题(firebase_messaging: ^7.0.3),花了几个小时修复它。对我来说,分两个步骤进行:
FIRST
更改

<key>FirebaseAppDelegateProxyEnabled</key>
<true/>
<key>FirebaseAppDelegateProxyEnabled</key>
<string>NO</string>
ios/Runner/Info.plist文件中。
更多信息在这里flutter: fcm ios push notifications doesn't work in release mode
第二
初始化推送时使用此代码
FirebaseMessaging firebaseMessaging = FirebaseMessaging();

if (Platform.isIOS) {
  firebaseMessaging.configure();
  userPermission = await firebaseMessaging.requestNotificationPermissions(
        const IosNotificationSettings());
}

08-17 06:58