Note that there are some explanatory texts on larger screens.

plurals
  1. POMail Composer crashes on iPhone
    text
    copied!<p>I have an app that I set to Landscape Left, Landscape Right and Portrait in my Info-plist. However, I am generally operating in a Landscape mode for all of my view controllers and I have set </p> <pre><code>- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {return interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight;} </code></pre> <p>Except for the view controller where I have a button that I want to allow the user to send emails. </p> <pre><code> - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {return YES;} </code></pre> <p>When I try to send an email my app crashes. It works just fine on my iPad. Here is my code for sending the email.</p> <pre><code>- (IBAction)sendEmail:(id)sender { if ([MFMailComposeViewController canSendMail]) { MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc] init]; mailComposer.mailComposeDelegate = self; [mailComposer setSubject:@"HI!"]; UIImage *myImage = [UIImage imageNamed:@"myPicture.png"]; NSData *imageData = UIImagePNGRepresentation(myImage); [mailComposer addAttachmentData:imageData mimeType:@"image/png" fileName:@"FullTitle.png"]; NSString *emailBody = @"Hi there!!"; [mailComposer setMessageBody:emailBody isHTML:NO]; [self presentModalViewController:mailComposer animated:YES]; } else { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Failure" message:@"Your device does not support email function" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; } } - (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error { switch (result) { case MFMailComposeResultCancelled: NSLog(@"Mail cancelled: you cancelled the operation and no email message was queued."); break; case MFMailComposeResultSaved: NSLog(@"Mail saved: you saved the email message in the drafts folder."); break; case MFMailComposeResultSent: NSLog(@"Mail send: the email message is queued in the outbox. It is ready to send."); break; case MFMailComposeResultFailed: NSLog(@"Mail failed: the email message was not saved or queued, possibly due to an error."); break; default: NSLog(@"Mail not sent."); break; } [self dismissModalViewControllerAnimated:YES]; } </code></pre> <p>I'm not sure, but I may have somehow locked myself in Landscape mode and so when I want to send an email, the iPhone wants to rotate to Portrait, but seems is not allowed to. I am not seeing any error messages in my console. Thanks in advance for your help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload