Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/103.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone邮件应用程序_Iphone_Ios - Fatal编程技术网

Iphone邮件应用程序

Iphone邮件应用程序,iphone,ios,Iphone,Ios,是否可以在不撰写新邮件的情况下打开Iphone邮件应用程序 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"mailto:%@?subject=My Subject", _recipient]]]; 这个代码不适合我 我只需要在主屏幕上打开邮件应用程序 谢谢 对不起,我的英语不好 }试试这个-[在此处输入链接说明][1][1]: -(void) Ema

是否可以在不撰写新邮件的情况下打开Iphone邮件应用程序

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"mailto:%@?subject=My Subject", _recipient]]];
这个代码不适合我

我只需要在主屏幕上打开邮件应用程序

谢谢

对不起,我的英语不好


}

试试这个-[在此处输入链接说明][1][1]:
   -(void) EmailMethod
  {
    MFMailComposeViewController *picker=[[MFMailComposeViewController alloc]init]; 
picker.mailComposeDelegate = self;
    [picker setToRecipients:@"mailid@mymail.com"];
[picker setSubject:@"Place your subject of mail here."];
[picker setMessageBody:@"Place your body of mail here." isHTML:YES];
    [self presentModalViewController:picker animated:YES];      
  }

   - (void)mailComposeController:(MFMailComposeViewController*)controller 
           didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 
 {   
    switch (result)
    {
     case MFMailComposeResultCancelled:
         UIAlertView *ErrorAlert = [[UIAlertView alloc] initWithTitle:@"Canceled !!" 
                      message:@"Mail sending cancelled." delegate:nil  
                      cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
        [ErrorAlert show];
        [ErrorAlert release];
        break;
     case MFMailComposeResultSaved:
        UIAlertView *ErrorAlert = [[UIAlertView alloc] initWithTitle:@"Saved" 
                                  message:@"Mail saved to Drafts." delegate:nil  
                                  cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
        [ErrorAlert show];
        [ErrorAlert release];
        break;
    case MFMailComposeResultSent:
        UIAlertView *ErrorAlert = [[UIAlertView alloc] initWithTitle:@"Email Sent" 
                     message:@"Thank you for recommending us to your friends via Email." 
                     delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
        [ErrorAlert show];
        [ErrorAlert release];
        break;
    case MFMailComposeResultFailed:
        UIAlertView *ErrorAlert = [[UIAlertView alloc] initWithTitle:@"Error !!" 
                                  message:@"Failed to send mail." delegate:nil  
                                  cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
        [ErrorAlert show];
        [ErrorAlert release];
        break;
    default:
        UIAlertView *ErrorAlert = [[UIAlertView alloc] initWithTitle:@"Error !!" 
                                  message:@"Failed to send mail." delegate:nil  
                                  cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
        [ErrorAlert show];
        [ErrorAlert release];
        break;
}
[self becomeFirstResponder];
[self dismissModalViewControllerAnimated:YES];