Skip to content

Instantly share code, notes, and snippets.

@codeswimmer
Created August 21, 2012 17:22
Show Gist options
  • Save codeswimmer/3417517 to your computer and use it in GitHub Desktop.
Save codeswimmer/3417517 to your computer and use it in GitHub Desktop.
MFMailComposeViewController issues
// ShareController.m (Conforms to MFMailComposeViewControllerDelegate)
- (void)createMailSheet {
MFMailComposeViewController *mailSheet = [MFMailComposeViewController new];
mailSheet.delegate = self; // Yells at me about conforming to UINavigationControllerDelegate, _not_ MFMailComposeViewControllerDelegate
[self.delegate presentShareSheet:mailSheet];
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
NSLog(@"Hello");
[controller dismissViewControllerAnimated:YES completion:^{}];
}
// In the delegate
- (void) presentShareSheet:(UIViewController *)shareSheet {
[self presentModalViewController:shareSheet animated:YES];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment