title: ios: Application tried to present a nil modal view controller on target
body: <p>I am developing an application,the requirement is to open email composer on a button click of UIAlertView.</p>
  
  <p>message which is in message body of email is copied from UITextView. i am using following code snipt:</p>
  
  <pre><code>-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
  if (buttonIndex == 0)
    {
        // opening message composer
    }
  else
    {
     MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
      picker.mailComposeDelegate = self;
      [picker setSubject:@"Test mail"];
      [picker setMessageBody:messageBody.text isHTML:YES];
      [self presentViewController:picker animated:YES completion:NULL];
    }
  }
   // mail compose delegate
  - (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
  {
        [self dismissViewControllerAnimated:YES completion:NULL];
  }
  </code></pre>
  
  <p>but the issue is that i am getting error saying Application tried to present a nil modal view controller on target. how we can open default mail composer in ios 7?</p>