0

I'm having a client testing an app on his device, he's using a iPhone 3GS with iOS 6.1.3.

The app contains a simple sections where you can share information and such about the app.

The problem he reports is that when the mail composer open up (presentViewController) the app the automatically closes the mail window right after it is displayed. So it goes up and then directly down again with the same result as if you would cancel the email.

I have absolutely no idea why this it's only this singel tester that has reported the problem. It works great on the simulater iOS 6.1 and 7.0 and it works great on all other devices like iPhone 4, 4S and 5. Here's the code, maybe I'm doing something wrong that the 3GS can't compile:

#pragma mark - Share to mail
// Share mail button
- (IBAction)shareTo_mail_BtnClicked:(id)sender
{
    [HUD showUIBlockingIndicatorWithText:@"Laddar mail"];

    // Email Subject
    NSString *emailTitle = PROMO_TEXT;
    // Email Content
    NSString *messageBody = SHARED_INFO_TEXT;

    // If mail account can't bee found
    if(![MFMailComposeViewController canSendMail]) {

        [HUD hideUIBlockingIndicator];

// Alert the user that no mail account is connected to the phone
            UIAlertView *warningAlert = [[UIAlertView alloc] initWithTitle:@"Ett fel inträffade" message:@"Kontrollera att du har ett mail-konto anslutet till telefonen." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [warningAlert show];
            return;

        }else {

            NSLog(@"Mail account found!");

        }

    MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
    mc.mailComposeDelegate = self;
    [mc setSubject:emailTitle];
    [mc setMessageBody:messageBody isHTML:NO];

    [self presentViewController:mc animated:YES completion:nil];
    [HUD hideUIBlockingIndicator];
}

// Mail did finish with result
- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
    switch (result)
    {
        case MFMailComposeResultCancelled:
            NSLog(@"Mail cancelled");
            break;
        case MFMailComposeResultSaved:
            NSLog(@"Mail saved");
            break;
        case MFMailComposeResultSent:
            NSLog(@"Mail sent");
            break;
        case MFMailComposeResultFailed:
            NSLog(@"Mail sent failure: %@", [error localizedDescription]);
            break;
        default:
            break;
    }

    // Close the Mail Interface
    [self dismissViewControllerAnimated:YES completion:nil];
}
2
  • Dude, did you found the solution to this issue?... I'm having the same problem. Thanks!
    – Guerrix
    Nov 26, 2013 at 16:32
  • @Guerrix unfortunately no. In this case I've only encountered it on one device and it's a 3GS running iOS 6.1. But since it works on newer devices and on iOS 7 I haven't tried to solve it any further.
    – user2707185
    Nov 27, 2013 at 13:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.