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 8877247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:25:20+00:00 2026-06-14T19:25:20+00:00

Hi i am getting confuse on MFMailComposeViewController delegate property, when i set mailer.mailComposeDelegate app

  • 0

Hi i am getting confuse on MFMailComposeViewController delegate property, when i set mailer.mailComposeDelegate app crash just after call [self presentModalViewController:mailer animated:YES]; and when i do mailer.delegate then app don’t crash but its view can’t hide after sending mail or just cancel it from its navigation bat button “Cancel”. I am getting stuck why this happen.
Let me share code, you get hint where i am doing mistake.

if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
    if(mailer)
    {
        mailer.mailComposeDelegate = self;
        //mailer.delegate=self;
        [mailer setSubject:@"What the Buck?"];
        imageData = UIImagePNGRepresentation(screenImgSubCat);        

        [mailer addAttachmentData:imageData mimeType:@"image/png" fileName:@"testapp"];        
        NSString *emailBody = @"What the Buck?! – www.testapp.com";
        [mailer setMessageBody:emailBody isHTML:NO];
        [self presentModalViewController:mailer animated:YES];
        //[mailer release];

    }
}
}

Updated

I change code and use mailer.mailComposeDelegate = self; and also comment this line [mailer release]; still giving me crash on when image is being loading.
Here is the Image what i am getting after crash.
enter image description here

  • 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-14T19:25:22+00:00Added an answer on June 14, 2026 at 7:25 pm

    In .h file are you adding MFMailComposeViewControllerDelegate

    @interface VideoPlayAndSharing : UIViewController
    <MFMailComposeViewControllerDelegate>  
    

    Display ComposerSheet

    -(void)displayComposerSheet
    {
        if ((videodta.length/1024)/1024 < 25)
        {
            NSLog(@"Video size >> %d",videodta.length/1024);
            MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
            picker.mailComposeDelegate = self;
    
            [picker setSubject:@"Your subject"];
    
    
            // Set up recipients
            NSArray *toRecipients = [NSArray arrayWithObject:@"rajneesh071@gmail.com"];
            NSArray *ccRecipients = [NSArray arrayWithObjects:@"second@example.com", @"third@example.com", nil];
            NSArray *bccRecipients = [NSArray arrayWithObject:@"fourth@example.com"];
    
            [picker setToRecipients:toRecipients];
            [picker setCcRecipients:ccRecipients];
            [picker setBccRecipients:bccRecipients];
    
            [picker addAttachmentData:videodta mimeType:@"video/mp4" fileName:@"MyPersonalMessage"];
    
            // Fill out the email body text
            NSString *emailBody = @"Type your message here";
            [picker setMessageBody:emailBody isHTML:NO];
            [self presentModalViewController:picker animated:YES];
        }
        else{
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"My Personal Message"
                                                            message:@"Video exceed the limit of 25 MB"
                                                           delegate:nil
                                                  cancelButtonTitle:@"OK"
                                                  otherButtonTitles:nil, nil];
            [alert show];
        }
    }
    

    and delegate method

    - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 
    {   
        // Notifies users about errors associated with the interface
        switch (result)
        {
            case MFMailComposeResultCancelled:
                message.text = @"Result: canceled";
                break;
            case MFMailComposeResultSaved:
                message.text = @"Result: saved";
                break;
            case MFMailComposeResultSent:
                message.text = @"Result: sent";
                break;
            case MFMailComposeResultFailed:
                message.text = @"Result: failed";
                break;
            default:
                message.text = @"Result: not sent";
                break;
        }
        [self dismissViewControllerAnimated:YES completion:nil];
    }  
    

    EDIT

    picker.mailComposeDelegate its delegate of MFMailComposeViewControllerDelegate

    Its respond to - (void)mailComposeController

    picker.delegate its delegate of UINavigationControllerDelegate

    Its respond to navigation controller not - (void)mailComposeController , so on cancel click it will not call, thats why your MFMailComposeViewController view is not hiding.

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

Sidebar

Related Questions

I'm getting confuse with this error. I've used in-app purchased (Test Products) with my
Just getting my head around Ruby metaprogramming. The mixin/modules always manage to confuse me.
i m getting confuse taking to that question why all variable names and values
I am getting confuse weither reference to subviews i am creating in a view
I am getting confuse with all those terms: ABI, calling convention, and hardware architecture.
I'm getting confused and frustrated after a few hours of trying all kinds of
i'm getting confuse about dataset and dataview, which i either use dataset to update
Im sorry if this is a newbie question but I'm getting confuse about how
I'm getting a bit confuse with the rails console. I'm trying to connect to
i am bit confuse in to getting the result into the two tables, i

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.