标签: mfmailcomposeviewcontroller

MFMailComposeViewController由于iOS6上的全局外观属性而崩溃

当我提出一个问题时,我遇到了以下崩溃MFMailComposeViewController:

2013-11-08 11:04:05.963 <redacted>[7108:1603] *** Assertion failure in NSDictionary *_UIRecordArgumentOfInvocationAtIndex(NSInvocation *, NSUInteger, BOOL)(), /SourceCache/UIKit/UIKit-2380.17/UIAppearance.m:1118
2013-11-08 11:04:06.032 <redacted>[7108:1603] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unknown key, "NSColor" in title text attributes dictionary'
Run Code Online (Sandbox Code Playgroud)

我在AppDelegate的application:didFinishLaunchingWithOptions:方法中将其跟踪到以下外观设置:

        [[UINavigationBar appearance] setTitleTextAttributes:
            @{NSForegroundColorAttributeName : [UIColor whiteColor]}];
Run Code Online (Sandbox Code Playgroud)

注释掉该行就可以了,但是会破坏应用程序的其余部分,所以我尝试将titleTextAttributes专门设置为空字典MFMailComposeViewController:

尝试#1

        [[UINavigationBar appearanceWhenContainedIn:
            NSClassFromString(@"MFMailComposeViewController"), nil]
            setTitleTextAttributes:@{ }];
Run Code Online (Sandbox Code Playgroud)

这导致同样的崩溃.和

        [[UINavigationBar appearanceWhenContainedIn:
            NSClassFromString(@"MFMailComposeViewController"), nil]
            setTitleTextAttributes:nil];
Run Code Online (Sandbox Code Playgroud)

也导致同样的崩溃.

尝试#2

我注意到这MFMailComposeViewController是一个UINavigationController,所以也许全局外观设置本地化到UINavigationController 的UIViewControllers .我整理了一些代码来确定MFMailComposeViewController中的视图控制器:

        for (UIViewController *viewController in mailViewController.viewControllers) {
            NSLog(@"%@", NSStringFromClass([viewController …
Run Code Online (Sandbox Code Playgroud)

objective-c ios uiappearance mfmailcomposeviewcontroller

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

使用Swift实施应用内电子邮件失败

我想使用swift来实现应用内电子邮件.单击该按钮时,会弹出电子邮件窗口.但是,我无法发送电子邮件.此外,点击取消删除草稿后,我无法返回到原始屏幕.

import UIkit
import MessageUI


class Information : UIViewController, MFMailComposeViewControllerDelegate{

    var myMail: MFMailComposeViewController!

    @IBAction func sendReport(sender : AnyObject) {

        if(MFMailComposeViewController.canSendMail()){
            myMail = MFMailComposeViewController()

            //myMail.mailComposeDelegate

            // set the subject
            myMail.setSubject("My report")

            //To recipients
            var toRecipients = ["lipeilin@gatech.edu"]
            myMail.setToRecipients(toRecipients)

            //CC recipients
            var ccRecipients = ["tzhang85@gatech.edu"]
            myMail.setCcRecipients(ccRecipients)

            //CC recipients
            var bccRecipients = ["tzhang85@gatech.edu"]
            myMail.setBccRecipients(ccRecipients)

            //Add some text to the message body
            var sentfrom = "Email sent from my app"
            myMail.setMessageBody(sentfrom, isHTML: true)

            //Include an attachment
            var image = UIImage(named: "Gimme.png")
            var imageData = …
Run Code Online (Sandbox Code Playgroud)

email-attachments ios swift mfmailcomposeviewcontroller

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

iOS9 MFMailComposeViewController的NavigationBar中的自定义字体?

好吧,这是我到目前为止:

在此输入图像描述

你可以在这里注意到我设法改变字体大小所以这很好,但我想要的样式还包括一个自定义字体.

请注意,实际样式会显示片刻,然后当状态栏更改为黑色字体时,自定义字体会丢失.

这是我在applicationDidFinish...中使用的代码

UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent

UINavigationBar.appearance().titleTextAttributes = [
     NSFontAttributeName: UIFont(name: "<MyCustomFont>", size: 32)!,
     NSForegroundColorAttributeName : UIColor.whiteColor(),
    ]

UINavigationBar.appearance().tintColor = UIColor.whiteColor()
UINavigationBar.appearance().opaque = true
UINavigationBar.appearance().barStyle = UIBarStyle.Black
UINavigationBar.appearance().barTintColor = UIColor.BlueColor()

UIBarButtonItem.appearance().tintColor = UIColor.whiteColor()

UIBarButtonItem.appearance().setTitleTextAttributes([
     NSFontAttributeName: UIFont(name: "<MyCustomFont>", size: 18)!,
     NSForegroundColorAttributeName : UIColor.whiteColor(),
    ], forState: UIControlState.Normal)
Run Code Online (Sandbox Code Playgroud)

注意:

我有一个实例,EKEventEditViewController风格正确应用.

问题似乎是MailComposer的相关问题

objective-c ios swift ios9 mfmailcomposeviewcontroller

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

MFMailComposeViewController错误[MC]过滤包ID的邮件表帐户

我执行发送消息的标准功能MFMailComposeViewController.

我的代码:

if MFMailComposeViewController.canSendMail()
{
    let mail = MFMailComposeViewController()
    mail.mailComposeDelegate = self
    mail.setToRecipients(["someemail@gmail.com"])
    mail.setSubject("Subject")
    mail.setMessageBody("Some Text", isHTML: false)
    self.presentViewController(mail, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)

控制器无法打开,我在控制台中看到一条从未见过的消息.

[MC]过滤捆绑包ID的邮件表帐户:[我的捆绑ID],源帐户管理:1

[MC]结果:没有

请帮忙.

swift ios10 mfmailcomposeviewcontroller

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

MFMailComposeViewController键盘问题

如何在不按MFMailComposeViewController中的发送或取消按钮的情况下关闭键盘?!

谢谢你的帮助.

iphone iphone-softkeyboard mfmailcomposeviewcontroller

9
推荐指数
2
解决办法
1723
查看次数

MFMessageComposeViewController外观iOS 7

我有一个外观代理,将barTintColor属性设置为绿色UINavigationBar

[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:54./255 green:165./255 blue:53./255 alpha:1]];

根据需要,我使用覆盖它 appearanceWhenContainedIn:

[[UINavigationBar appearanceWhenContainedIn:[INFSearchViewController class], nil] setBarTintColor:[UIColor colorWithWhite:0.80 alpha:1]];

这很好用.

但是,当我提出MFMessageComposeViewController它遵守UINavigationBar代理时,看起来如下所示.

在此输入图像描述

这显然看起来很糟糕,我宁愿MFMessageComposeViewController不坚持代理,但试图做

[[UINavigationBar appearanceWhenContainedIn:[MFMessageComposeViewController class], nil] setBarTintColor:[UIColor whiteColor]];

没有影响.

我应该采取什么行动?

ios uiappearance ios7 mfmailcomposeviewcontroller

9
推荐指数
2
解决办法
5500
查看次数

Swift中的MFMailComposeViewController不会被忽略

这是示例代码:

import UIKit
import MessageUI

class ViewController: UIViewController, MFMailComposeViewControllerDelegate {

@IBAction func showEmail(sender : AnyObject) {
    var emailTitle = "Test Email"
    var messageBody = "This is a test email body"
    var toRecipents = ["a.nakhimov@gmail.com"]
    var mc: MFMailComposeViewController = MFMailComposeViewController()
    mc.mailComposeDelegate = self
    mc.setSubject(emailTitle)
    mc.setMessageBody(messageBody, isHTML: false)
    mc.setToRecipients(toRecipents)

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

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of …
Run Code Online (Sandbox Code Playgroud)

objective-c uiviewcontroller swift ios8 mfmailcomposeviewcontroller

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

点击发送或取消按钮后如何关闭邮件视图控制器

在发送邮件时,点击发送或取消按钮视图控制器停留在那里和应用程序停止.

// swift 2.2; xcode 7.3.1;

  if( MFMailComposeViewController.canSendMail() ) {
            print("Can send email.")
        }

        var subjectText = "Verification"
        var toReceipients = ["notorious.roman@gmail.com"]


        // var msgBody = "Verified"


        var mc:MFMailComposeViewController = MFMailComposeViewController()
        mc.mailComposeDelegate = self

        mc.setSubject(subjectText)
        mc.setMessageBody("Verified", isHTML: false)

        mc.setToRecipients(toReceipients)
        self.presentViewController(mc, animated: true, completion: nil)



    }

    func mailComposeController(controller: MFMailComposeViewController, didFinishWithResult result: MFMailComposeResult, error: NSError?) {



        self.dismissViewControllerAnimated(true, completion: nil)

    }
Run Code Online (Sandbox Code Playgroud)

ios swift mfmailcomposeviewcontroller

9
推荐指数
2
解决办法
6291
查看次数

MFMailComposeViewController不会被忽略

我正试图MFMailComposeViewController在我的应用程序中发送电子邮件的情况下实施.问题是,在呈现MFMailComposeViewController它之后不会被"取消"或"发送"按钮解雇,只需稍微向上滚动即可.

以下是它的介绍:

func mailButtonDidPressed {
        let emailTitle = "Test email"
        let messageBody = "some body bla bla bla"
        let toRecipents = "email@gmail.com"

        let emailComposer = MFMailComposeViewController()
        emailComposer.setSubject(emailTitle)
        emailComposer.setMessageBody(messageBody, isHTML: false)
        emailComposer.setToRecipients([toRecipents])
        emailComposer.mailComposeDelegate = self
        self.presentViewController(emailComposer, animated: true, completion: nil)
    }
Run Code Online (Sandbox Code Playgroud)

并解雇委托代码:

func mailComposeController(controller: MFMailComposeViewController, didFinishWithResult result: MFMailComposeResult, error: NSError?) {
    switch (result) {
    case MFMailComposeResultSent:
        print("You sent the email.")
        break
    case MFMailComposeResultSaved:
        print("You saved a draft of this email")
        break
    case MFMailComposeResultCancelled:
        print("You cancelled sending this …
Run Code Online (Sandbox Code Playgroud)

email iphone ios swift mfmailcomposeviewcontroller

9
推荐指数
5
解决办法
2255
查看次数

如何使用MFMailComposeViewController设置ToRecipients

我正在尝试收到我选择发送电子邮件的电子邮件.但我不知道如何setToRecipients我在MFMailComposeViewController视图中选择的用户.

if ([MFMailComposeViewController canSendMail])
    {
        mailer = [[MFMailComposeViewController alloc] init];

        mailer.mailComposeDelegate = self;
        [mailer setSubject:@"A Message from blablabl"];

        NSMutableArray *usersTo = [[NSMutableArray alloc] init];
        toRecipients = usersTo;
        [mailer setToRecipients:toRecipients];

        NSString *emailBody = @"blablablabal";

        [mailer setMessageBody:emailBody isHTML:YES];

        // only for iPad
        // mailer.modalPresentationStyle = UIModalPresentationPageSheet;

        [self presentModalViewController:mailer animated:YES];
    }
    else
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Failure" 
                                                        message:@"Your device doesn't support the composer sheet" 
                                                       delegate:nil 
                                              cancelButtonTitle:@"OK" 
                                              otherButtonTitles: nil];
        [alert show];
    }
Run Code Online (Sandbox Code Playgroud)

委托 http://pastie.org/3281814

iphone xcode objective-c mfmailcomposeviewcontroller

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