Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8225599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:28:00+00:00 2026-06-07T15:28:00+00:00

I am trying to take a screenshot and email it using the mail composer.

  • 0

I am trying to take a screenshot and email it using the mail composer. Everything works great except the mail composer won’t dismiss. This post seems to have the same problem, but the solution provided did not work for me. Can't dismiss the email composer view in iPhone?

- (IBAction)Email:(id)sender {
UIGraphicsBeginImageContext(self.view.frame.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

NSData * imageData = UIImageJPEGRepresentation(image, 1.0);

if ( [MFMailComposeViewController canSendMail] ) {
    MFMailComposeViewController * mailComposer = [[[MFMailComposeViewController alloc] init] autorelease];
    mailComposer.delegate = self;
    [mailComposer setSubject:@"Risk Assessment"];
    [mailComposer addAttachmentData:imageData mimeType:@"image/jpeg" fileName:@"attachment.jpg"];     
    [self presentModalViewController:mailComposer animated:YES];        
}
}

The above code works great. How do I call this bottom portion. It seems like the compiler just skips past it.

-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{
if (error){
    NSString *errorTitle = @"Mail Error";
    NSString *errorDescription = [error localizedDescription];
    UIAlertView *errorView = [[UIAlertView alloc]initWithTitle:errorTitle message:errorDescription delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
    [errorView show];                
    [errorView release];
}
[controller dismissModalViewControllerAnimated:YES];

}

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T15:28:01+00:00Added an answer on June 7, 2026 at 3:28 pm

    Try

    mailComposer.mailComposeDelegate = self;
    

    instead of

    mailComposer.delegate = self;
    

    From the MFMailComposeViewController documentation:

    @property(nonatomic,assign) id<MFMailComposeViewControllerDelegate> mailComposeDelegate;
    

    The delegate object is responsible for dismissing the view presented by this view controller at the appropriate time. Therefore, you should always provide a delegate and that object should implement the methods of the MFMailComposeViewControllerDelegate protocol.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to take a screenshot of my Android application using Robotium, I'm using
I am using Silverlight 3 and I am trying to take a screenshot of
Well, I'm trying to take a screenshot for a window in OpenGL using LWJGL.
I am trying to take a full page screenshot of a url using selenium
I'm an trying to take a screenshot in the background using CutyCapt My application
I'm currently trying to take a screenshot using libx11 #include <X11/Xlib.h> #include <X11/Xutil.h> #include
I'm trying to find a (somewhat) easy way to take a screenshot on window
trying to take this content: <div class=content>one,two,three</div> <div class=content>four,five,six</div> <div class=content>seven,eight,nine</div> and .split and
I am trying to take a photo and post it on my facebook wall.
I am trying to take a screenshot of an application and I would like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.