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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:47:52+00:00 2026-05-28T22:47:52+00:00

I use MFMailComposeViewController to send mail in my app. But when present mail compose

  • 0

I use MFMailComposeViewController to send mail in my app. But when present mail compose view controller, all of navigation buttons are disabled (except back button in select mail address screen), i must use Home button to quit app. Does anyone has idea?
Here is screen shot:
Screen shot
2

Code:

- (void)shareVieEmail
{
    if ([MFMailComposeViewController canSendMail]) {
        MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
        mailViewController.mailComposeDelegate = self;
        [mailViewController setSubject:@"Test subject"];
        [mailViewController setMessageBody:@"Mail message body" isHTML:NO];

        NSData *imageData = [NSData dataWithContentsOfFile:photourl];
        [mailViewController addAttachmentData:imageData mimeType:@"image/jpg" fileName:@"example_photo"];
        [self presentModalViewController:mailViewController animated:YES];
    } else {
        [[[UIAlertView alloc] initWithTitle:@"Cannot send mail" message:@"Device is unable to send email in its current state" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show];
    }
}

Delegate method :

- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
    switch (result)
    {
        case MFMailComposeResultCancelled:
            //NSLog(@"Result: canceled");
            break;
        case MFMailComposeResultSaved:
            //NSLog(@"Result: saved");
            break;
        case MFMailComposeResultSent:
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Result" message:@"Mail Sent Successfully" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
            [alert show];
        }
            break;
        case MFMailComposeResultFailed:
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Result" message:@"Mail Sent Failed" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
            [alert show];
        }
            break;
        default:
            //NSLog(@"Result: not sent");
            break;
    }
    if (error) {
        [[[UIAlertView alloc] initWithTitle:@"Cannot send mail" message:[NSString stringWithFormat:@"ERROR:%@", [error userInfo]] delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show];
    }
    [self dismissModalViewControllerAnimated:YES];
}

And in header file, I declared implement MFMailComposeViewControllerDelegate.

  • 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-05-28T22:47:53+00:00Added an answer on May 28, 2026 at 10:47 pm

    I had exactly the same problem. and it took me a while to figure this out but no surprise it came down to customized UIBarButtonItem

    I bet in your UIBarButtonItem.h there is a method

    -(void)setEnabled:(BOOL)enabled ;
    

    and the implementation looks like this:

    -(void)setEnabled:(BOOL)enabled {
        if (self.customView) {
            if ([[self.customView.subviews objectAtIndex:0] isKindOfClass:[UIButton class]])         {
                ((UIButton*)[self.customView.subviews objectAtIndex:0]).enabled = enabled;
            }
        }
    }
    

    and this is causing problem so as soon as you comment out this method your problem should go away.

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

Sidebar

Related Questions

IN my application i use MFMailComposeViewController class to send mail and i know in
I use MFMailComposeViewController canSendMail in my app everything works great but if there are
My app is landscape based. I'd like to use MFMailComposeViewController in landscape but can't
I'm trying to use the MFMailComposeViewController in an iPhone app I'm building, but I
I would like to use standard MFMailComposeViewController but I need to tell user, whether
Am trying to send a mail to recipient from iPhone app without user's interaction.
From a tableview I want to present a MFMailComposeViewController. I don't want to use
I use MFMailComposeViewController to send a message in html format. If my html template
I want to to use MFMailComposeViewController to send an email, and I already have
Use of rails 3 recaptcha. In view _form.html.erb insert <%= recaptcha_tags %> But when

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.