AndyDentFree / im-plausibilities

Explorations of apps for Apple's iMessage
MIT License
6 stars 0 forks source link

imUrlDataApp Send from App displays weird controller rendering of message #4

Open AndyDentFree opened 5 months ago

AndyDentFree commented 5 months ago

The documentation for setting the message parameter in Apple's MFMessageComposeViewController doc says:

If your app has an iMessage app extension, you can display your iMessage app within the message compose view, just as you would in the Messages app. To display your iMessage app, create and assign an MSMessage object to this property.

That works to enable sending a custom message, that will be properly directed to the matching iMessage extension, as seen in imUrlDataApp

However, as seen in the screenshot below, the message dialog doesn't display our custom controller's rendering. Instead there's a weird little lozenge with a copy of our icon and a cross. Tapping the cross removes our attached message property and reduces the message to a simple text message.

Screenshot 2024-06-13 at 19 04 39

AndyDentFree commented 5 months ago

Just had a great session with the Messges and Stickers team at Apple via the WWDC Labs and got an answer!

This will be tested and confirmed when have time, in July, but the quick answer is that the layout property had not been set, which defines the kind of layout being used. They were surprised that the call worked at all!

AndyDentFree commented 5 months ago

From some brief testing, setting the layout to a MSMessageTemplateLayout does improve the appearance but the most you can get is a custom bubble - this is not a presentation of our composition or play UI. That makes sense when you think about it - the composer here is basically just showing the transcript hosted inside your app.

AndyDentFree commented 5 months ago

Digging further, I think the docs are still wrong or, at best, misleading.

The message property docs say:

If your app has an iMessage app extension, you can display your iMessage app within the message compose view, just as you would in the Messages app

However, that seems likely to only work for using MSMessageLiveLayout and is expected to be similar to the case they describe:

One instance for a message in the input field (when you stage the message by calling insert(_:completionHandler:))