Mastering iOS 12 Programming - Third Edition

Mastering iOS 12 Programming - Third Edition

Title Page
Copyright and Credits
Dedication
Packt Upsell
Contributors
Preface
35
Index

Understanding sessions, messages, and conversations


This chapter has mostly focused on user interface-related aspects of iMessage apps. When you create an iMessage app, your app will sooner or later have to send a message. To do this, you use the MSMessage and MSSession objects. In addition to messages and sessions, the MSConversation class represents the conversation context that your extension exists in. These three classes together allow you to send messages, identify recipients in conversations, and even update or collapse existing messages in the messages transcript.

When an iMessage extension is activated, willBecomeActive(with:) is called in MessagesViewController. This method receives an instance of MSConversation that you can use to send messages, stickers, and even attachments. More importantly, the conversation contains unique identifiers for participants in the conversation and the currently selected message.

The localParticipantIdentifier and remoteParticipantIdentifier properties...

Unlock full access

Continue reading with a subscription

Packt gives you instant online access to a library of over 7,500 practical eBooks and videos, constantly updated with the latest in tech

End of Section 5

Your notes and bookmarks