Sending the Message

With this preparation, you’re ready to move the text from the text view into a new email message. This section shows you the code for that process: the checks for Internet and email will come in the next sections.

Expanding the tapButton Method

You’ll expand on the tapButton method that you have created in ViewController. Add the declaration of a new method to ViewController.h, as shown in Listing 4.1. This message will use MFMailComposeViewController to send the message. As you will see, you need to provide a delegate that conforms to MFMailComposeView-ControllerDelegate to handle the send result.

Listing 4.1 Adding a New Method to View Controller

#import <UIKit/UIKit.h>@interface ViewController ...

Get Learning iCloud Data Management: A Hands-On Guide to Structuring Data for iOS and OS X 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.