Framework

Messages

Create app extensions that allow users to send text, stickers, media files, and interactive messages.

Overview

You can use the Messages framework to create two types of app extensions: Sticker packs and iMessage apps. Both extension types can be created as standalone apps or as app extensions within a containing iOS app.

For more information on creating and working with app extensions, see App Extension Programming Guide.

Sticker Packs

Sticker packs simply provide static sets of stickers, images that users can send inline as messages or peel off and attach to message bubbles in the transcript. Sticker packs do not require any code. You add stickers by dragging image files into the Sticker Pack folder inside the Stickers asset catalog. Valid image files must meet the following specifications:

  • The image must be a PNG, APNG, GIF, or JPEG file.

  • The file must be less than 500 KB.

  • For the best results, the image should not be smaller than 100 x 100 points or larger than 206 x 206 points.

Messages supports three sticker sizes, which are displayed in a grid-based browser. In the Xcode Attributes inspector, pick one of the following sizes for your sticker pack:

  • Small. 100 x 100 points @3x (300 x 300 pixels).

  • Medium. 136 x 136 points @3x (408 x 408 pixels).

  • Large. 206 x 206 points @3x (618 x 618 pixels).

For optimal quality and performance, provide sticker images of the size you choose.

To learn more about creating animated stickers, see Creating Stickers with Motion.

To learn more about submitting sticker packs to the App Store, see Preparing Sticker Submissions.

iMessage Apps

iMessage apps leverage the full framework to interact with the Messages app.

Use iMessage apps to:

To learn more about submitting iMessage Apps to the App Store, see Preparing Your iMessage App for Submission.

Topics

Effects Support

Adding Sticker Packs and iMessage Apps to Effects

Enable your Sticker pack or iMessage app in the MSMessagesAppPresentationContext.media context.

Custom Sticker Packs

class MSStickerBrowserViewController

A view controller that provides dynamic content to the standard sticker browser.

class MSStickerBrowserView

A browser view that displays a dynamically generated list of stickers.

class MSStickerView

A view for displaying a sticker.

enum MSStickerSize

The size of the stickers in the browser view.

Custom iMessage App Interface

class MSMessagesAppViewController

The principal view controller for iMessage apps.

protocol MSMessagesAppTranscriptPresentation

A protocol that provides support for displaying live messages in the transcript of the Messages app.

enum MSMessagesAppPresentationStyle

Presentation styles that describe your iMessage app’s appearance.

Message Content

class MSConversation

An object that represents a conversation in the Messages app.

class MSSticker

A sticker that can be sent as a new message or attached to an existing balloon in the Messages app’s transcript.

Interactive Messages

class MSMessage

A custom message object.

class MSSession

A session object used to create and update messages.

class MSMessageLayout

An abstract base class that defines the appearance of MSMessage objects in the conversation transcript.

class MSMessageTemplateLayout

A template-based layout for custom messages.

class MSMessageLiveLayout

A layout that provides a custom, interactive view inside the transcript.

Errors

let MSStickersErrorDomain: String

The error domain for stickers.

let MSMessagesErrorDomain: String

The error domain for iMessage apps.

enum MSMessageErrorCode

The error codes used in NSError objects generated by the Messages framework.