'Flutter iOS firebaseMessaging doesn't handle RemoteMessages without Notification block

I intercept messages as follows:

FirebaseMessaging.onMessage.listen((RemoteMessage message) async {
  print('Message data: ${message.data}');
  
});

I send messages from the server as follows:

Message message = Message.builder()
                    .setToken("TOKEN")
                    .putAllData(payload)
                    .setApnsConfig(
                            ApnsConfig.builder()
                                    .setAps(Aps.builder()
                                            .setContentAvailable(true)
                                            .build())
                                    .build())
                    .build();

On Android everything works fine, but on iOS the message is displayed only if I add a "notification" block on the server. What I'm doing wrong?



Solution 1:[1]

The problem seems to be with version 11 of firebase_messaging library. When I rolled back to 10.0.9 it worked as expected

Solution 2:[2]

You need to set up apple configuration, thats why you stacked into blockings

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 CrystalKnight
Solution 2 theredboy