标签: mfmailcomposer

如何像MFMailComposer一样创建UITextField?

我想像UITextField一样创建一个MFMailComposer,就像我们输入一个电子邮件地址一样,它转换成蓝色圆形按钮就像形状一样.我不想使用Three20的MailComposer.我想创建自己的.任何想法如何实现这一目标?或者如果已经有UITextField或其他任何控件,请告诉我.

编辑:我已经检查了three20的TTCatalog演示.它有我想要的所有东西,除了一些像我手动输入电子邮件地址时它没有转换成蓝色按钮.我也想用自己的方法发送邮件,因为我正在加密消息.我想获取在To字段中输入的所有电子邮件地址,我想要一个像MFMailComposer一样的Cc/Bcc字段.

uitextfield ios4 mfmailcomposer

5
推荐指数
1
解决办法
1326
查看次数

取消按钮在MFMailComposeViewController - iOS 8中不执行任何操作

我已经创建了一个MFMailComposeViewController并且能够显示它但是一旦我按下取消按钮,取消按钮和发送按钮就会变灰并且不显示操作表.有什么我想念的吗?

MFMailComposeViewController *m = [[MFMailComposeViewController alloc] init];
[m setToRecipents:@[@"abc@example.com"]];
[m setSubject:@"Subject"];
[m setMessageBody:@"..." isHTML:YES];
[m setMailComposeDelegate:self];
[self presentViewController:m animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

这是一个截图: 显示灰色按钮的图象那么我有什么遗漏或者我应该提交错误报告吗?

cancel-button ios mfmailcomposer ios8

5
推荐指数
1
解决办法
2344
查看次数

MailComposer didFinishWith结果在Swift 3.0中不起作用

我将我的应用程序转换为swift 3.0并遇到问题MailComposeController.当我调用函数时:

`func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?){
    controller.dismiss(animated: true, completion: nil)
}`
Run Code Online (Sandbox Code Playgroud)

首先,我有一个错误的信息: 在此输入图像描述

我有什么奇怪的,因为我复制并粘贴了这个方法MFMailComposeViewControllerDelegate.当我Error改为NSError它工作,但我收到一个警告信息,这个方法需要是私人的,以避免这个警告.

当我在mailComposer并看到电子邮件并尝试点击Cancel此控制器时不会消失.任何解决方案如何解雇这个控制器?

ios mfmailcomposer swift swift3

5
推荐指数
1
解决办法
930
查看次数

MFMailComposeViewController canSendMail返回YES但不在iOS中发送邮件

以下是我在邮件中发送附件的代码.这很好用.我能够发送邮件,但我并不总是收到邮件.

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

// Set the subject of email
[picker setSubject:@"My data file"];

// Add email addresses

[picker setToRecipients:[NSArray arrayWithObjects:emailId, nil]];


// Fill out the email body text
NSString *emailBody = @"Hello, \n Please find the data from the iOS app in the attachments.\n\n Thank you.\nMy Team.";

// This is not an HTML formatted email
[picker setMessageBody:emailBody isHTML:NO];

// Create NSData object from file
NSData *exportFileData = [NSData dataWithContentsOfFile:filePath];

// Attach image data …
Run Code Online (Sandbox Code Playgroud)

ios mfmailcomposer mfmailcomposeviewcontroller

4
推荐指数
1
解决办法
3694
查看次数

将数组保存到文本文件中并附加到swift中的电子邮件中

我最近一直在试图将.txt文件创建到电子邮件中.

我有一个变量,它是我要写入txt文件的字符串列表,然后作为附件添加到电子邮件中.

我还没有找到任何体面的文件.

期待一些伟大的投入.谢谢!

编辑----------我发现了这个代码示例:我收到以下错误.

@IBAction func createFile(sender: AnyObject) {
        let path = tmpDir.stringByAppendingPathComponent(fileName)
        let contentsOfFile = "Sample Text"
        var error: NSError?

        // Write File
        if contentsOfFile.writeToFile(path, atomically: true, encoding: NSUTF8StringEncoding, error: &error) == false {
            if let errorMessage = error {
                println("Failed to create file")
                println("\(errorMessage)")
            }
        } else {
            println("File sample.txt created at tmp directory")
        }
    }
Run Code Online (Sandbox Code Playgroud)

let path = tmpDir.stringByAppendingPathComponent(fileName)

我收到错误告诉我"类型'字符串'的值没有成员URLByAppendingPathComponent'"

我该如何解决这个问题?

ios export-to-csv mfmailcomposer swift

4
推荐指数
1
解决办法
3992
查看次数

SWIFT - 未调用mailComposeDelegate:取消MFMailComposeViewController不起作用

在同一个viewcontroller上,我们可以发送电子邮件或短信来向朋友发送信息.应用程序中的短信完全有效.但对于电子邮件,电子邮件应用程序在我的应用程序中打开,包含我要求写的所有信息但是不可能通过推送取消来解雇它,没有任何反应.我试过mc.mailComposeDelegate = self或mc.delegate = self,而MFMailComposeViewControllerDelegate也在顶部.我在互联网上看了一切,我没有找到任何解释.永远不会调用mailComposeController!你有什么主意吗 ?

class inviteAFriendViewController: UIViewController, MFMessageComposeViewControllerDelegate, MFMailComposeViewControllerDelegate {

@IBAction func emailButtonDidTouch(sender: AnyObject) {
    sendEmail()
}

func sendEmail() {
    let emailTitle = "text"
    let messageBody = "text"
    let toRecipents = [""]

    let mc = MFMailComposeViewController()

    //mc.mailComposeDelegate = self

    mc.delegate = self

    mc.setSubject(emailTitle)
    mc.setMessageBody(messageBody, isHTML: false)
    mc.setToRecipients(toRecipents)

    presentViewController(mc, animated: true, completion: nil)
}

func mailComposeController(controller2: MFMailComposeViewController, didFinishWithResult result: MFMailComposeResult, error: NSError?) {
    switch result.rawValue {
    case MFMailComposeResultCancelled.rawValue:
        print("Mail cancelled")
        controller2.dismissViewControllerAnimated(true, completion: nil)
    case MFMailComposeResultSaved.rawValue:
        print("Mail saved")
        controller2.dismissViewControllerAnimated(true, completion: …
Run Code Online (Sandbox Code Playgroud)

delegates mfmailcomposer swift mfmailcomposeviewcontroller

4
推荐指数
2
解决办法
3265
查看次数

NSString新行在邮件中不起作用?

当用户发送邮件时,我想要显示两个UITextView.问题是我希望第二个textview中的文本显示在邮件的新行中.

我已经尝试过使用NSLog,它在那里工作得很好,邮件API有问题或为什么不能正常工作?

我的代码看起来像这样:

NSString *desc = descriptionTextView.text;
NSString *ingredients = ingredientsTextView.text;
NSString *emailBody = [NSString stringWithFormat:@"%@\n\n%@", desc, ingredients];
NSLog(@"%@\n\n%@", desc, ingredients);

-(void)displayComposerSheet 
Run Code Online (Sandbox Code Playgroud)

{MFMailComposeViewController*picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self;

[picker setSubject:titleLabel.text];
NSString *desc = descriptionTextView.text;
NSString *ingredients = ingredientsTextView.text;
NSString *emailBody = [NSString stringWithFormat:@"%@\n\n%@", desc, ingredients];
NSLog(@"%@\n\n%@", desc, ingredients);
[picker setMessageBody:emailBody isHTML:YES];


[self presentModalViewController:picker animated:YES];
[picker release];
Run Code Online (Sandbox Code Playgroud)

}

- (void)viewDidLoad {
titleLabel.text = [recipeData valueForKey:@"title"];
descriptionTextView.text = [recipeData valueForKey:@"description"];
ingredientsTextView.text = [recipeData valueForKey:@"ingredients"];
[super viewDidLoad];
Run Code Online (Sandbox Code Playgroud)

}

iphone nsstring mfmailcomposer

3
推荐指数
1
解决办法
659
查看次数

无需在MFMailComposeViewController中保存草稿


单击MFMailComposeViewController的取消按钮后,生成保存草稿的动作表.
在此输入图像描述


我不想要这个动作表我怎么能实现呢?
提前致谢.

cocoa-touch ios mfmailcomposer

3
推荐指数
1
解决办法
811
查看次数

如何推送MFMailComposeViewController?(iOS 5)

从tableview我想呈现一个MFMailComposeViewController.我不想使用该presentModalViewController:animated:方法,而是推送视图控制器,因此它与此表视图中的其他动画一致.

因为MFMailComposeViewController是UINavigationController并且不支持推送导航控制器,所以我使用了:

[[self navigationController] pushViewController:[mailComposer topViewController] animated:YES];
Run Code Online (Sandbox Code Playgroud)

这有效,但当我点击取消按钮时,它会发出警告:

提交由其超级视图剪辑的动作表.某些控件可能无法响应触摸.在iPhone上尝试 - [UIActionSheet showFromTabBar:]或 - [UIActionSheet showFromToolbar:]而不是 - [UIActionSheet showInView:].

UIActionSheet底部的"取消"按钮不响应触摸.有谁知道是否可以推送MFMailComposeViewController?

objective-c uiactionsheet ios mfmailcomposer

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

设备不支持MFMail作曲家表

我有一个应用程序,我想发送邮件.我有一个按钮,它指向MailComposer表,它在我的模拟器中工作得很好但不能发送邮件所以我需要使用设备我的问题是每次我点击按钮指示它的邮件编辑器设备不支持MFMailComposer表,我使用的设备是3G iphone.

iphone mfmailcomposer

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

在Swift 3.0迁移后不调用MFMailComposeViewControllerDelegate方法

我的应用程序具有电子邮件撰写功能,它在Swift 2.2上运行完美.最近我将代码迁移到Swift 3.0并坚持这个问题.在下面分享我的代码段:

import MessageUI

class ViewController: UIViewController,     MFMailComposeViewControllerDelegate {
 func sendEmail() {
    if MFMailComposeViewController.canSendMail() {
      let mail = MFMailComposeViewController()
      mail.mailComposeDelegate = self
      mail.setToRecipients(["someone@somewhere.com"])
      mail.setSubject("Sending you an in-app e-mail...")
      mail.setMessageBody("<p>You're so awesome!</p>", isHTML: true)
      self.present(mail, animated: true)
    } else {
        //  handle failure
    }
  }

 func mailComposeController(_ controller:    MFMailComposeViewController, didFinishWith result: MFMailComposeResult,  error: Error?) {

    controller.dismiss(animated: true)
  }

 @IBAction func mailClicked(_ sender: AnyObject) {    
    sendEmail()
  }
 }
Run Code Online (Sandbox Code Playgroud)

我已将mailComposeDelegate设置为self,将_放入委托方法并尝试搜索时找到的所有解决方案.但无法解决问题.

任何帮助是极大的赞赏.

ios mfmailcomposer swift3

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