In order to send an iMessage in a messages extension, you need to embed the data of the message into a URL. See how the process works in this tutorial.
- When you're going to send a message…through a messages extension,…you send all the data in that message through a URL object.…In that object, you put all of your data…inside of a URL query, and then you can access that data…from the other device by decoding that query.…So before we send the message,…let's look at preparing that URL.…So I'm going to create a method at the bottom of my code…in Messages View Controller, and I'm going to call this one…getMessageURL,…and that's going to ask for a title,…which is a string, and a note, which is also a string,…and it's going to return a URL object.…
So in here, the first thing I'm going to do…is create URL components.…This enables us to easily create URL parameters…and then we can put those inside of a URL object.…So we'll call this components and I'm going to set it…equal to URL components, just calling the constructor,…then I'm going to create the title query.…So we'll call this qTitle,…and I'm going to set it equal to URLQueryItem,…and it's going to receive a name and a value…
Released
5/3/2017- Setting up Messages extensions
- Showing multiple view controllers
- Creating delegate methods
- Preparing a message URL
- Opening an extension from a message
- Combining messages into one bubble
- Identifying the user in a conversation
- Opening a host app from an extension
- Creating a sticker pack
- Adding stickers in a Messages extension
Share this video
Embed this video
Video: Preparing a message URL