iMessage Extension Development for iOS
An iMessage extension is a separate Extension target within an iOS application that embeds into the Messages app. When the user opens the app drawer under the message input field and launches your mini-interface directly in the conversation. Stickers, interactive cards, shared games, data transfer through messages—all without leaving the chat.
Two Modes: Sticker Pack vs MSMessagesAppViewController
Sticker Pack — the simplest option. Created without code: add an Extension target of type "Sticker Pack Application", drag PNG/APNG/GIF files into Stickers.xcassets. Apple generates the UI automatically. Sizes: Small (100×100 pt), Regular (136×136 pt), Large (206×206 pt). APNG for animation—up to 500 KB, GIF—up to 25 MB, but GIF is undesirable due to quality.
MSMessagesAppExtension — a full-featured Extension with UIKit/SwiftUI. Here, MSMessagesAppViewController is the entry point. Two display modes: Compact (bottom of screen, ≈225 pt height) and Expanded (nearly full screen). Switch via requestPresentationStyle(.expanded).
Most importantly: MSMessage and MSMessageLayout. This is the message object inserted into the chat. It has a URL (with custom app scheme), MSMessageTemplateLayout with image, title, subtitle. When the recipient taps such a message, they get the same extension (if installed) or an invitation to install the app.
Issues Not Discovered Immediately
Shared state between two participants. To transfer data (game move, poll choice), you cannot use UserDefaults or Keychain directly—the recipient has a different device. Data is encoded in the message URL through query parameters or base64 in the path. URL size is limited—don't overuse it.
Pattern: MSMessage.url = URL(string: "yourapp://state?data=\(encodedState)"). The recipient parses the URL in willBecomeActive(with:).
App Group and shared container. The Extension is isolated from the main application by default. If you need to read application data in the extension (custom stickers, authorization), configure App Group: use the same group.com.yourapp.shared in Capabilities for both the main target and extension. Then use UserDefaults(suiteName:) and FileManager.containerURL(forSecurityApplicationGroupIdentifier:).
MSMessagesAppViewController doesn't support all UIKit components. UIActivityViewController inside an iMessage Extension crashes—you can't share content via the system share. UIImagePickerController also doesn't work. Use PHPickerViewController for image selection.
Memory. Extensions operate under strict memory limits (~100 MB). Loading heavy resources or image caches without limits is a direct path to EXC_RESOURCE crashes. Use NSCache with countLimit and totalCostLimit.
What to Check During Development
- Extension works correctly in compact and expanded mode
- Messages decode correctly on the recipient's side (test with two real devices)
- App Group is configured if main application data is needed
- Stickers are correct sizes and formats, animations don't exceed limits
- Extension doesn't crash when receiving a message without the application installed
Timeline
Sticker Pack without code: 1–3 days (design + build). iMessage Extension with interactive cards: 3–5 weeks. Multiplayer game or complex data exchange: 6–10 weeks. Cost is calculated after analyzing interaction scenarios.







