2

I just realized Apple now allows developers to create iMessage Applications. Is anyone familiar with just how much an iMessage Application (or extension) can do? For instance:

  • can the extension send a text without the user pressing the regular send button?
  • can the extension read incoming messages? (I doubt it can)
  • can it see who the user is texting?
  • can it see the text being typed by the user?

Let's say I want to make an extension that reads what the user has typed (in the normal Messages interface), looks for any arithmetic in the text, performs the arithmetic then subs in the answer, and sends the message, all in one click. Is that possible?

I am new to Apple Development and know nothing about their API and frameworks, so I'm a little lost about what's available. I'm a Computer Science student and am hoping I can apply my current knowledge to learn quicker.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Sanders0492
  • 55
  • 1
  • 4
  • On the iMessage Apple Developer Page there are links to the Messages Framework documentation, WWDC videos, developer forums and example apps. I suggest you watch the videos and review the documentation as a first step. Link to docs: https://developer.apple.com/imessage/ – Robotic Cat Dec 01 '16 at 23:39

1 Answers1

4

Apple's new Messages Framework is pretty limited and, at the moment, does not really allow any of the things you are talking about. The user always has to press the send button, you're unable to send a message without a user's final action. You're also not able to see any other messages in the conversation apart from the ones your app has sent into a certain MSConversation object. Also, it is not possible to see the text the user has typed into the message field, all you're able to do is insert your own text, attachment or MSMessage object.

The only thing that is kind of possible is seeing who is part of the conversation. Messages.framework won't let you see any names, but you can use the remoteParticipantIdentifiers to see who else is in the conversation or use the localParticipantIdentifier to get information about the user who is using your app to send the message. While your app is unable to see the name, you are able to use it in a label on your MSMessage object, see the following code taken from this twocentstudios tutorial:

let layout = MSMessageTemplateLayout()
layout.caption = "My name is $\(conversation.localParticipantIdentifer.uuidString)."
conversation.insert(message, localizedChangeDescription: nil)
Yannik
  • 2,463
  • 2
  • 16
  • 7
  • 1
    Thank you! My idea relies on seeing what the user is currently typing, so I suppose my only option is to make my own view identical to the standard Messages' keyboard. That should make the user feel at home while allowing me to gather their text. Requiring the native send button kind of gets in the way of simplicity for the user, but I think I can come up with something. Thanks again! – Sanders0492 Dec 02 '16 at 00:27