标签: mfmailcomposeviewcontroller

iOS 7状态栏中的MFMailComposeViewController是黑色的

我在带有MFMailComposeViewController的ios 7应用程序中有一个反馈按钮.用户单击此按钮后,mailcomposer将打开,但状态栏将更改为黑色.有谁知道我该怎么办?

我只有ios7才有这个问题.我为ios7定制了我的应用程序.

    MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
            mailController.mailComposeDelegate = self;

            [mailController setSubject:@"Feedback"];
            // Fill out the email body tex
            NSString *emailBody = [NSString stringWithFormat:@"testest"],
                                   [UIDevice currentDevice].model,
                                   [UIDevice currentDevice].systemVersion];
            [mailController setMessageBody:emailBody isHTML:NO];
            [mailController setToRecipients:[NSArray arrayWithObjects:@"support@test.com",nil]];

            dispatch_async(dispatch_get_main_queue(), ^{
                [self presentModalViewController:mailController animated:YES];
}
Run Code Online (Sandbox Code Playgroud)

ios ios7 mfmailcomposeviewcontroller

59
推荐指数
6
解决办法
2万
查看次数

如何在MFMailComposeViewController的MailComposer Sheet中添加UIImage

我想在一个UIImage组合表中插入一个s MFMailComposerViewController.

请注意我不想附加它们,但我想使用HTML代码将它们放在一个表格中,这将是电子邮件正文的一部分.

iphone attachment ios mfmailcomposeviewcontroller

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

无法解雇MFMailComposeViewController,委托未调用

我打电话MFMailComposeViewControllerUITableViewController.问题是当我在"邮件撰写"窗口中选择" 取消"或" 发送"按钮时,从不调用委托方法:

mailComposeController:(MFMailComposeViewController*)controllerdidFinishWithResult 
Run Code Online (Sandbox Code Playgroud)

这是表视图类:

@implementation DetailsTableViewController
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section==0 && indexPath.row==4) {
        //SEND MAIL
        MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
        controller.mailComposeDelegate = self;
        if ([MFMailComposeViewController canSendMail]) {
            [controller setSubject:[NSString stringWithFormat:@"Ref %@",[item objectForKey:@"reference"]]];
            [controller setMessageBody:@" " isHTML:NO]; 
            [controller setToRecipients:[NSArray arrayWithObject:[item objectForKey:@"email"]]]; 
            [self presentModalViewController:controller animated:YES];
        }
        [controller release];       
    }
}

- (void)mailComposeController:(MFMailComposeViewController*)controllerdidFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
    // NEVER REACHES THIS PLACE
    [self dismissModalViewControllerAnimated:YES];
    NSLog (@"mail finished");
}
Run Code Online (Sandbox Code Playgroud)

应用程序不会崩溃.按下"取消"或"发送"按钮后,"构建窗口"将停留在屏幕上并禁用按钮.我可以按Home键退出应用程序.

我可以打开TableView的其他模态视图,但不能打开MailCompose.

cocoa-touch objective-c ios mfmailcomposeviewcontroller

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

MFMailComposeViewController - iPad

我已经设置了一个MFMailComposeViewController,它可以在iPhone上正常工作,但在iPad上崩溃,说:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target...
Run Code Online (Sandbox Code Playgroud)

那么为什么会创建一个零模态视图呢?

    MFMailComposeViewController *message = [[MFMailComposeViewController alloc] init];
    [message setMessageBody:@"My message here"  isHTML:NO];
    [message setToRecipients:[NSArray arrayWithObject:@"my@domain.com"]];
    [message setSubject:@"Request Info"];
    message.mailComposeDelegate = self;
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
        message.modalPresentationStyle = UIModalPresentationFormSheet;
    [self presentModalViewController:message animated:YES];
    [message release];
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

ipad mfmailcomposeviewcontroller

30
推荐指数
2
解决办法
1万
查看次数

更改iOS 12中MFMailComposeViewController中导航栏的标题颜色不起作用

如何更改UINavigationBarin MFMailComposeViewControllerin 的标题颜色iOS 12

这就是我在做的事情:

import MessageUI

extension MFMailComposeViewController {
    open override func viewDidLoad() {
        super.viewDidLoad()
        navigationBar.isTranslucent = false
        navigationBar.isOpaque = false
        navigationBar.barTintColor = .white
        navigationBar.tintColor = .white
        navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white]
    }
}
Run Code Online (Sandbox Code Playgroud)

在iOS 10中工作:

ios 10

在iOS 11中工作:

ios 11

在iOS 12中不起作用:

ios 12

iphone uinavigationbar ios swift mfmailcomposeviewcontroller

30
推荐指数
1
解决办法
2568
查看次数

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万
查看次数

使用MFMailComposeViewController时出现问题

我有一个棘手的问题.在我的一个应用程序中,有超过150,000次下载...我遇到了一个很少发生的问题,我似乎无法弄明白.

问题如下:在用户可以通过电子邮件共享列表的视图中,我使用打开邮件窗口MFMailComposeViewController.但是,在少数情况下,应用程序似乎使用邮件编辑器出现问题.用户按下共享按钮,邮件窗口向上滑动,等待约1-2秒,然后再次关闭.邮件窗口中没有内容,尽管我确实向其发送数据.我自己无法在任何设备或模拟器中重新创建问题,但是有一位同事.我在他的手机上使用XCode运行应用程序并在日志中获得以下内容:

2013-03-01 14:43:39.604 appname[318:907] <MFMailComposeRemoteViewController: 0x1ebfb100> timed out waiting for fence barrier from com.apple.MailCompositionService
2013-03-01 14:43:39.631 appname[318:907] viewServiceDidTerminateWithError: Error Domain=XPCObjectsErrorDomain Code=2 "The operation couldn’t be completed. (XPCObjectsErrorDomain error 2.)"
Run Code Online (Sandbox Code Playgroud)

我搜索了错误"从com.apple.MailCompositionService等待栅栏屏障超时",但无法找到任何帮助.

有没有人有这方面的经验?我该如何解决?

我打开视图的代码:

-(void)displayComposerSheetWithBodyString:(NSString *)aBody
{
    if ([MFMailComposeViewController canSendMail])
    {
        MFMailComposeViewController *picker = [[MFMailComposeViewController alloc]init];
        picker.mailComposeDelegate = self;

        [picker setSubject:@"Lista"];

        NSString *emailBody = aBody;
        [picker setMessageBody:emailBody isHTML:NO];

        [self.navigationController presentModalViewController:picker animated:YES];
    }
    else
    {
        [[[UIAlertView alloc]initWithTitle:NSLocalizedString(@"Din enhet är inte redo att skicka e-post. Kontrollera dina inställningar", nil)
                                   message:nil
                                  delegate:self …
Run Code Online (Sandbox Code Playgroud)

objective-c ios mfmailcomposer mfmailcomposeviewcontroller

27
推荐指数
2
解决办法
1万
查看次数

锁定MFMailComposeViewController中的字段

是否有可能以某种方式锁定字段,MFMailComposeViewController以便用户无法更改正文,收件人等?我需要用户发送的电子邮件去特定帐户和身体符合某些标准,所以如果用户大幅度编辑格式,一切都可能会出现可怕的错误.当时正文从用户的数据填充输入到上一个视图中的文本字段和日期选择器.

基本上我认为将字段锁定而不是显示警告或者说"请不要编辑消息"这样更专业,所以如果字段无法锁定,这不是一个大问题,但任何帮助我将不胜感激.

email iphone locking ios mfmailcomposeviewcontroller

24
推荐指数
1
解决办法
2万
查看次数

MFMailComposeViewController马上解散

情况是MFMailComposeViewController将被呈现.我看到它已经完成了一半,但后来被解雇了.

这是错误:

_serviceViewControllerReady:error:Error Domain = _UIViewServiceInterfaceErrorDomain Code = 3"无法完成操作.(_UIViewServiceInterfaceErrorDomain error 3.)"

这是我提供MFMailComposeViewController的源代码:

-(void) MailExecute {
    if ([MFMailComposeViewController canSendMail]) 
    {
        MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];   
        mailViewController.mailComposeDelegate = self;
        [mailViewController setSubject:NSLocalizedString(@"Check this new look", @"")];
        [mailViewController setMessageBody: @"my new look" isHTML:YES];

        [self presentModalViewController:mailViewController animated:YES];

        [mailViewController release];
    }
    else 
    {
        UIAlertView *alertInternal = [[UIAlertView alloc]
                                      initWithTitle: NSLocalizedString(@"Notification", @"")
                                      message: NSLocalizedString(@"You have not configured your e-mail client.", @"")
                                      delegate: nil
                                      cancelButtonTitle:NSLocalizedString(@"OK", @"")
                                      otherButtonTitles:nil];
        [alertInternal show];
        [alertInternal release];
    }
}
Run Code Online (Sandbox Code Playgroud)

奇怪的是,有时会发生,有时则不然.请帮帮我!我花了将近1个工作日来解决这个问题,但没有成功.

objective-c ios mfmailcomposer mfmailcomposeviewcontroller

24
推荐指数
1
解决办法
1万
查看次数

如何使用MFMailComposeViewController在电子邮件正文中添加图像

我试图找出在电子邮件正文中添加图像的最佳方式,而不是在ios中作为附件.

1)Apple提供了一个功能" addAttachment ",并且doc说,要在内容中添加任何图像,我们应该使用这个功能,但我尝试了这个功能,并发了一封邮件,我在浏览器上查了一下,就收到了一个附件.

2)其次,许多博客都说要使用base64编码,但这也不会起作用,图像会以破坏的形式发送.

所以朋友们,请帮助我找到最好的解决方案来做到这一点.

问候Ranjit

ios ios5 mfmailcomposeviewcontroller

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