- iOS 10.0+
Setting Required Properties
Define the message’s appearance using the message’s
layoutproperty. Use the
MSMessageclass to set an image, video, or audio file for the message. This class also defines a number of text elements, such as the message’s title, subtitle, caption, and subcaption.
When a message from an iMessage app arrives, the following situations generate their corresponding events:
The message is associated with an existing session. The previous message is moved to the bottom of the transcript and updated with the new message’s content.
When a user selects a message from an iMessage app, the behavior varies depending on where the message appears:
iOS device with the iMessage app installed.
If the extension is not running, the system launches it using the
init(session:)presentation style. The conversation’s
selectedproperty is set to the tapped message, and the view controller’s
didmethods are called.
If the extension is running, the system calls the view controller’s
willmethod. It then updates the conversation’s
selectedproperty and calls the view controller’s
didto respond to the user selecting a new message.
You can also save messages to the file system and process them later.
iOS device without the iMessage app installed. The system opens the App Store for iMessage and prompts the user to install the iMessage app.
macOS. The system attempts to open the URL. If the system does not recognize the URL, it displays an error message.