Post not yet marked as solved
I've spent about six hours so far trying to write a basic example of supporting Siri intents in a SwiftUI app to no avail. It seems most information on this topic online is out of date. I just want do something simple like activate a button in my app with a voice command. Can someone confirm that this is possible?
So far this looks like the best description of the steps to set it up. https://medium.com/simform-engineering/how-to-integrate-siri-shortcuts-and-design-custom-intents-tutorial-e53285b550cf. But I think some steps are missing and it feels very complex.
I work on a Messaging app. I am trying to update our app so that it will donate communication intents whenever a message is received. The problem is, even though I am successfully creating an INSendMessageIntent, with a sender (INPerson) with an associated INImage, iOS 15 never actually shows the sender's avatar/image.
Is there something more I need to do? This is basically what my code does:
INImage *senderImage = [INImage imageWithImageData:imageData];
INPerson *const contact = [[INPerson alloc]
initWithPersonHandle:handle
nameComponents:components
displayName:context.notification.content.title
image:senderImage
contactIdentifier:nil
customIdentifier:senderId.stringValue];
INSendMessageIntent *intent = [[INSendMessageIntent alloc]
initWithRecipients:@[recipient]
outgoingMessageType:INOutgoingMessageTypeUnknown
content:messageText
speakableGroupName:nil
conversationIdentifier:threadId
serviceName:@"Instagram Direct"
sender:contact
attachments:nil];
nseContentHandler([notifContent contentByUpdatingWithProvider:intent error:&error]);
I am doing all of this in the Notification Service Extension. I can see that the image is valid/nonnull and the contentByUpdatingWithProvider:error: method does not set an error, so I am quite confused