相关疑难解决方法(0)

从我自己的应用程序中启动Apple Mail App?

我发现的是

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto:"]];
Run Code Online (Sandbox Code Playgroud)

但我只是想打开Mail应用程序而不仅仅是作曲家视图.只是处于正常或最后状态的邮件应用程序.

有任何想法吗?

email ios

61
推荐指数
8
解决办法
5万
查看次数

什么时候[MFMailComposeViewController canSendMail]会返回NO

我的iPhone应用程序正在使用MFMailComposeViewController类发送带有附件的应用内电子邮件.如果类MFMailComposeViewController的"canSendMail"方法返回true(YES),则应用程序将仅尝试显示邮件编辑器对话框.具体来说,如果以下方法返回YES,则显示邮件编写器,否则将向用户显示错误警告对话框,指出设备上没有设置电子邮件帐户:

- (BOOL)canDeviceSendEmail
{
    Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
    return mailClass != nil && [mailClass canSendMail];
}
Run Code Online (Sandbox Code Playgroud)

一组测试人员报告说,即使在设备上设置了电子邮件帐户,他们也会收到此错误警告对话框.测试人员使用iPhone 3G和OS 3.1.3.因此,MFMailComposeViewController类必须存在,并且"canSendMail"方法必须返回NO.

因此,我的问题是:除了在设备上没有设置电子邮件帐户的情况下,"canSendMail"方法在其他情况下是否返回NO?

〜谢谢

iphone objective-c

43
推荐指数
4
解决办法
3万
查看次数

ios:应用程序尝试在目标上显示nil模态视图控制器

我正在开发一个应用程序,要求是在UIAlertView的按钮上打开电子邮件编辑器.

从UITextView复制邮件的邮件正文中的邮件.我正在使用以下代码片段:

-(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];
}
Run Code Online (Sandbox Code Playgroud)

但问题是我得到错误,说应用程序试图在目标上呈现一个零模态视图控制器.我们如何在ios 7中打开默认邮件编辑器?

ios7 mfmailcomposeviewcontroller

29
推荐指数
3
解决办法
2万
查看次数

iOS - 从我的应用程序启动 Gmail 时无法添加附件

我正在使用MFMailComposeViewController撰写带有附件的电子邮件,并且工作正常

现在我想用本机电子邮件客户端撰写带有附件的图像。我正在使用下面的代码

 NSString *customURL =[NSString stringWithFormat:@"googlegmail:///co?to=[t0]&subject=[subject]&body=[body]"];

    NSURL *url = [NSURL URLWithString:customURL];
    if ([[UIApplication sharedApplication]
         canOpenURL:url])
    {

        [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {

            NSLog(@"%d",success);
        }];
    }
    else
    {
        //not installed, show popup for a user or an error
    }
Run Code Online (Sandbox Code Playgroud)

它与主题和正文工作正常,但我无法附加附件(即:Zip 文件、屏幕截图)。

在使用 Gmail 或任何其他客户端应用程序时,有什么方法可以添加附件。

gmail email-client ios

6
推荐指数
0
解决办法
620
查看次数