Created
April 16, 2015 02:21
-
-
Save jenhausu/2b41cd04567075d68fee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<MFMailComposeViewControllerDelegate> | |
UIMessage.framework |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error | |
{ | |
switch (result) | |
{ | |
case MFMailComposeResultCancelled: | |
break; | |
case MFMailComposeResultSaved: | |
break; | |
case MFMailComposeResultSent: | |
break; | |
case MFMailComposeResultFailed: | |
NSLog(@"Mail sent failure: %@", [error localizedDescription]); | |
break; | |
default: | |
break; | |
} | |
[self dismissViewControllerAnimated:YES completion:NULL]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ([MFMailComposeViewController canSendMail]) | |
{ | |
NSString *emailTitle = @""; | |
NSString *messageBody = @""; | |
NSArray *toRecipents = [NSArray arrayWithObject:@"[email protected]"]; | |
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init]; | |
mailViewController.mailComposeDelegate = self; | |
[mailViewController setSubject:emailTitle]; | |
[mailViewController setMessageBody:messageBody isHTML:YES]; | |
[mailViewController setToRecipients:toRecipents]; | |
[self presentViewController:mailViewController animated:YES completion:NULL]; | |
} else { | |
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Failure" | |
message:@"Your device doesn't support the composer sheet" | |
delegate:nil | |
cancelButtonTitle:@"OK" | |
otherButtonTitles:nil]; | |
[alert show]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment