iosapple-push-notificationssirikitios15

Using a group icon with iOS 15 communication notifications


I have followed the instructions in this great Gist to get a INSendMessageIntent working to display the user's profile image on iOS 15. And it works great.

However, I am unable to figure out how to get the image for a group message to be displayed.

I cannot get it to simultaneously show both the group name and an icon for it. If I don't provide the group as an INPerson in recipients then speakableGroupName will not appear in the notification UI. But the INImage on the group's INPerson is never displayed, nor is the sender's image when I do this.

iMessage seems to show the group icon as well as the group name, so it seems possible with this API.


Solution

  • I ran into the same issue and https://stackoverflow.com/a/68705169/673745 gave me the idea to make this work. You need to pass at least 2 recipients (I used the current user and the sender), then do this and it works!

    // Swift
    sendMessageIntent.setImage(image, forParameterNamed: \.speakableGroupName)
    
    // Objective-C
    [sendMessageIntent setImage:image forParameterNamed:"speakableGroupName"];