An Introduction to Messages Extensions on iOS

    Enrico Sustayo

    What Are Extensions?

    A couple years ago in 2014 with the introduction of iOS 8, Apple introduced the Extensions Framework. Then, I conjectured that the framework will play an important role delivering functionalities in future iOS and OS X releases. As it turns out, Apple has been doing exactly that in the past couple years. This year, they added support for building iMessage extensions.

    Every time Apple add new extension points, they have always been compatible with subsequent releases. For example, the Today widget extension that many people use has a new look in iOS 10, but developers don’t have to update their Today extensions they wrote in previous iOS versions. Even though Apple never mention that this will always be the case, I expect that that is still going to be true in future iOS releases. Thus, iMessage extensions that you write today will probably work in future iOS releases.

    Outside of iMessage, there are other messaging apps that have been gaining traction in the market. Notably, WeChat and LINE are popular in China and Japan. Some have rudimentary messaging extension support, for example, support for shopping through WeChat. LINE published a lot of LINE branded apps that provide extra functionalities on top of their messaging app. It looks like iMessage extension is following the path that was carved by the other third party messaging apps, but when the operating system vendor itself provides the feature it will have tighter integration with the system.

    On the macOS side, it doesn’t look like many of the features in the iMessage extensions is supported. We’re only able to view stickers on macOS. It’s not uncommon for some extensions to be supported on just one platform and not the other. In the past that has happened with the custom keyboard extension.

    Building iMessage Apps

    There are two main ways to build your iMessage App: Standalone or extension to an iOS app. They are almost the same thing, the main difference is: if you build a standalone app your app will be listed only on the Messages App Store, if it’s an extension to an iOS app it will be listed on the Messages App Store as well as the main App Store.

    In Xcode 8 and above, you can conveniently create a new iMessage Application or Sticker Pack that includes pre-filled templates. You can also get these templates with File -> New -> Target… if you’re building an extension. Apple published a lot of extensive guides on the details of each API you can use on iMessage Apps. If you have been writing iOS Apps and extensions, these are fairly straightforward. The main points worth noting are:
    – iMessage Apps activate from a MSMessagesAppViewController subclass which is a subclass of UIViewController
    – Expect willBecomeActive(with conversation: MSConversation) and didResignActive(with conversation: MSConversation) to be called often and save/restore your data here.
    – Expect willTransition(to presentationStyle: MSMessagesAppPresentationStyle) to be called when the user expands/minimise the iMessage App UI.

    Creating new iMessage Application target

    Remember, as with any other iOS extensions, you can only reuse classes that you compiled for this extension or frameworks you included in this extension. Don’t expect to be able to reuse everything you wrote for you iOS apps.

    Building Sticker Packs

    Apple included one more extension point in the Messages app, which is the Stickers Pack extension. This is a much simpler version of the iMessage app, where one can package their iMessage stickers without a single line of code. Yes, you read that right, no single line of code.

    The only requirements when publishing an iMessage stickers app are:
    – 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.

    If you just want to publish your doodles and never opened Xcode before, it wouldn’t take you more than an hour to follow the procedure. Heck, app signing and uploading to iTunes Connect may take you longer than the app itself.

    Lastly, if you think this is just a side to the main iMessage app, consider this: Super Mario Run, Nintendo’s first iOS app published an iMessage sticker pack to promote their iOS game. It has been sitting on the top chart for a long time and has been successful in getting people to know about the launch of their game long before the game is ready. Furthermore, LINE made $270 million last year in 2016 just from selling stickers in their sticker store.

    iMessage App Store

    iMessage App Store can only be accessed from the Messages App. Amusingly, you can only get on the iMessage App Store from the conversations view. If you never messaged anyone you can’t get to the iMessage App Store. The store is a separate store from the main App Store, but all updates to the stickers go through the main App Store app.

    When you send an iMessage app to someone who doesn’t have it installed, there will be a link to that extension in the iMessage App Store. I think this would be the main way people discover new iMessage apps and stickers.

    Interesting iMessage Apps

    There are several interesting iMessage apps since iOS 10 launched, including some from Apple. For example, Apple Music has an iMessage extension that allows us to share what we’re listening to and let the recipient listen to the song even if they aren’t an Apple Music subscriber.

    Another interesting and unexpectedly popular type of iMessage extension is games, namely two player turn-based games. We’ve seen quite a lot of this kind of games in the early days of iOS, but it seems that iMessage extension brought people’s games from their home screen to their messaging app, which they may be seeing a more often than the second or third page of their home screen. Words With Friends, a popular iOS game that is played by million people in the world including former president of the United States Barack Obama, released an iMessage app that is a mini version of their game. It dominated the top chart in the iMessage App Store for many weeks after the launch. There are also other turn based multiplayer games that found success in the top chart of the iMessage App Store.

    Finally, there are also unexpectedly clever Messages Apps like Phoneys and Grammar Snob. Phoneys mimic the iMessage bubbles and made it so that it looks like your friend is sending you flattering messages. Grammar Snob cleverly has stickers with grammar corrections that you can put on the grammatically incorrect messages. Phoneys was pulled from the Messages App Store shortly after launch for mimicking Apple’s message bubble design.

    Final Words

    It sure looks like Apple has been developing the iOS Extensions framework extensively since its introduction in iOS 8. We saw an unusual addition of the extensions framework in iOS 10 with the iMessage extension framework. iMessage extensions may or may not be an integral part of your app’s business. But it looks like the extension framework itself will keep growing as we see new iOS releases.

    For implementation details, we recommend you watch the WWDC video iMessage Apps and Stickers, Parts 1 and 2.