IOS: How to get message body, subject and recepien

2019-08-24 09:42发布

问题:

I am sending email via following method:

-(void) sendEmailOpenControllerWithSubject:(NSString *)subject messsageBody:(NSString *) message
{
    MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init];
    controller.mailComposeDelegate = self;
    [controller setSubject:subject];
    [controller setMessageBody:message isHTML:NO];
    [controller setToRecipients:[[NSArray alloc] initWithObjects:currentProspect.email, nil]];
    if (controller) [self presentModalViewController:controller animated:YES];
}

I am setting message body subject and recipient but it is likely that user changes these attribute in MailComposer.

What I need:

So I want to get the contents like message body,subject and recipients after the email is sent. As it is possible that user has changed these via mail composer.

回答1:

Starting in iOS 5, you can register to be notified of changes to the availability of text message sending.

A userInfo dictionary key for the MFMessageComposeViewControllerTextMessageAvailabilityDidChangeNotification

NSString *const MFMessageComposeViewControllerTextMessageAvailabilityKey;

Refer more on Message UI Framework here