Chapter 35
Building iMessage Apps Using Messages Framework

As mentioned in the previous chapter, not only can you create a sticker pack, the Messages framework allows developers to build another kind of messaging extensions, known as iMessage apps, that let users interact with your app without leaving the Messages app.

Let me give an example, so you will better understand what an iMessage app can do for you.

You probably have used the Airbnb app before.Let's say, you're now planning the next vacation with your friends. You come across a really nice lodging place to stay, and you want to ask your friends for opinions. So what would you do to share the place?

Figure 35.1. Airbnb App
Figure 35.1. Airbnb App

For now, you may capture a screenshot and then send it over to your friends through Messages, Whatsapp or any messaging clients. Alternatively, you may use the built-in sharing option of the Airbnb app to share a link to your friends, so he/she can view the lodging place on

Both ways are not perfect, however.

The screenshot may only show partial information of the lodging place. If you send the link to your friends over Messages, it should display the complete information of the place. But opening a link in iOS usually means switching to the mobile Safari browser. The user will need to view the details in Safari, and then switch back to the Messages app to reply the message. This isn't a big deal. That said, as developers, we always look for ways to improve the user experience of an app.

Starting from iOS 10, the Airbnb app comes with a message extension or what we called the iMessage app. The updated app lets you share any of the recently viewed hotels/lodging options right in the Messages app. Figure 35.2 displays the workflow.

Figure 35.2. Sharing a lodging place using Airbnb's iMessage app
Figure 35.2. Sharing a lodging place using Airbnb's iMessage app

What's interesting is on the receiving side. Assuming the recipient's device has Airbnb installed, he/she can reveal the details of the lodging place right in the Messages app. Furthermore, if the recipient loves the place, he/she can tap the Like button and reply back.

Cool, right? Everything is now done right in Messages, without even launching the Airbnb app or switching to the mobile browser.

You may wonder what happens if the recipient doesn't have the Airbnb app installed?

Messages will bring up the App Store and suggest the user to download the Airbnb app. As you may realize, this is a new way to promote your app. When the recipient receives the message, it is likely he/she will install the app so as to view the message. Your app user just helps you promote your app by sending messages.

Now that you should have a better idea of iMessage apps and why it is important to build for your existing app, let's dive into the implementation.

The Demo App

We will make use of the Icon Store app that we built in chapter 18/19 as a demo. If you haven't read those chapters, it is time to take a look. Even though it is not mandatory, the better you understand the chapter, the better you will understand what I'm going to discuss.

If you're ready to get started, download the Icon Store app from Unzip it and compile the demo to see if it works.

Figure 35.3. The Icon Store app
Figure 35.3. The Icon Store app

Meanwhile, if you want to share a favorite icon to another user, you probably do a screen capture and send the screenshot over Messages. What we are going to do is build an iMessage app such that users can access the icons right the Messages app. Users can pick an icon and send it to another user. On the receiving end, the recipient can reveal the icon details simply by tapping the message.

Figure 35.4. How the iMessage app of Icon Store works
Figure 35.4. How the iMessage app of Icon Store works

To continue reading and access the full version of the book, please get the full copy here. You will also be able to access the full source code of the project.

results matching ""

    No results matching ""