Chapter 33. Mail and Messages
Your app can present an interface allowing the user to edit and send a mail message or an SMS message. Two view controller classes are provided by the Message UI framework; your app will link to MessageUI.framework and import <MessageUI/MessageUI.h>
. The classes are:
- MFMailComposeViewController
- Allows composition and sending of a mail message.
- MFMessageComposeViewController
- Allows composition and sending of an SMS message.
New in iOS 6, the Social framework lets you post a message to Twitter or Facebook (or Weibo) on the user’s behalf. Link to Social.framework and import <Social/Social.h>
. You can use an SLComposeViewController to give the user an interface to construct and send a message, or prepare and post a message directly using SLRequest.
Also new iOS 6, UIActivityViewController (Chapter 26) provides a unified interface for letting the user choose any of the built-in messaging milieus (mail, SMS, Facebook, Twitter, and Weibo). To give the user a chance to send a message through one of these milieus, with an initial message body or other data that you supply, you should use UIActivityViewController. However, I have not found any way to make UIActivityViewController fill in the fields of a proposed mail message. For example, for my users to be able to email me from within one of my apps, I must fill in the To field in the mail composition form. MFMailComposeViewController lets me do that; UIActivityViewController doesn’t. Thus, the Message UI ...
Get Programming iOS 6, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.