I want the push notification to only contain the title. When I send a message from the Firebase console, it works, but when I try to do the same via the API, it doesn't work for iOS (works fine on Android).
Edit: What I'm trying to accomplish is to only show the title in the notification that shows up in the notification drawer when the app is not open. If body is added, it is shown under the title in the notification.
This is the push notification I'm sending:
{
"to": "/topics/breaking",
"priority":"high",
"notification": {
"title":"Dette er en test"
}
}
And I get nothing back
If I add body to the notification:
{
"to": "/topics/breaking",
"priority":"high",
"notification": {
"title":"Dette er en test",
"body":"hello"
}
}
I get this in return
{
aps = {
alert = {
body = Hello;
title = "Dette er en test";
};
};
"gcm.message_id" = "xxxxxxx";
}
Here is the code to print out what I receive:
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
self.parseNotification(application, userInfo: userInfo as NSDictionary!)
}
func parseNotification(_ application: UIApplication, userInfo: NSDictionary!) {
print(userInfo)
}
How can I get the notification on iOS without adding body to the request?