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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:34:02+00:00 2026-05-12T13:34:02+00:00

There is a part of the iPhone app that I’m developing where you can

  • 0

There is a part of the iPhone app that I’m developing where you can send images using the in app mail in iPhone 3.0. Selecting an image from the camera roll works perfectly, but when I try to go from the camera to the email (ie – from the UIImagePickerController to the MFMailComposeViewController), the application crashes.

This is the code for running the camera :

- (BOOL)startCameraPickerFromViewController:(UIViewController*)controller usingDelegate:(id<UIImagePickerControllerDelegate, UINavigationControllerDelegate>)delegateObject 
{
    if ( (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) || (delegateObject == nil) || (controller == nil)) 
        return NO;
    UIImagePickerController* picker = [[UIImagePickerController alloc] init];
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    picker.delegate = delegateObject;
    picker.allowsImageEditing = NO;
    [controller presentModalViewController:picker animated:YES];
    return YES;
}

And this is the code for finishing with the camera :

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
    NSLog(@"Called finish picking");
    self.imageForSending = theImage;

    //   NSData *imageData = UIImageJPEGRepresentation(image, 1);

    [[picker parentViewController] dismissModalViewControllerAnimated:YES];
    [(ChannelTwoAppDelegate *) [[UIApplication sharedApplication] delegate] recoverNavigationBar];

    [self performSelector:@selector(sendEmail) withObject:nil afterDelay:0.45];
    [picker release];
}

And this is the code for sending the mail :

- (void) sendEmail {

    [(ChannelTwoAppDelegate *) [[UIApplication sharedApplication] delegate] hideNavigationBar];
    if (![MFMailComposeViewController canSendMail])
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"שגיאה", @"") message:NSLocalizedString(@"לא ניתן לשלוח מייל ממכשיר זה", @"")
                                                       delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
        [alert show];   
        [alert release];
    }
    else
    {
        MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
        controller.mailComposeDelegate = self;
        [[controller navigationBar] setTintColor:[UIColor colorWithRed:120.0/255.0 green:0 blue:0 alpha:1.0]];
        NSData *imageData = UIImageJPEGRepresentation(imageForSending, 1);
        [controller addAttachmentData:imageData mimeType:@"image/jpg" fileName:@"storyImage.jpg"];
        [controller setSubject:@""];
        [controller setToRecipients:[NSArray arrayWithObject:@""]];
        [self presentModalViewController:controller animated:YES];
        [controller release];
    }

}

I erased the email address and the subject since it is less relevant.

The crash happens at presentModalViewController of the email. Again – this exact code work perfectly when selecting an image from the camera roll…

Help ?
I’ve been fighting with this one for a while and could really use some new input.
Thanks!

  • 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-12T13:34:02+00:00Added an answer on May 12, 2026 at 1:34 pm

    Hi to anyone watching, I found the answer to my own question.
    Its a timing issue between the presentation of two modal view controllers

    Basically, I already knew that this was an issue, but, I hadn’t put in a long enough wait.
    The wait was enough for selecting an image from the camera roll but not long enough for coming back from the camera.

    [self performSelector:@selector(sendEmail) withObject:nil afterDelay:0.45];

    changed to :

    [self performSelector:@selector(sendEmail) withObject:nil afterDelay:1.0];

    I also added an UIActivityIndicator to indicate that something is happening for the user.

    Happy coding !

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

Sidebar

Related Questions

I'm developing an iPhone app. I've got a function that reads data from a
I'm developing an app that would display images and change them according to the
I'm making an iphone app. All you need to know is that there is
I have an IPhone app that uses webservices to get data from a server.
I am creating an iPhone app where the user can send their work in
I'm developing an iPhone/iPad app that supports dragging items between table views. Since all
I'm building an iPhone app that, in part, allows the user to log in
I'm using the Google Analytics library in my iPhone/iPad app; one part of the
I'm part of a team developing a fairly large iPad app and there are
I am working on an iPhone app that can determine the bpm (beats per

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.