通过点击UITextVIew(iOS 8 beta bug)中的邮件链接显示MFMailComposeViewController, [英] cant dismiss MFMailComposeViewController shown by clicking mail link in UITextVIew (iOS 8 beta bug)

查看:115
本文介绍了通过点击UITextVIew(iOS 8 beta bug)中的邮件链接显示MFMailComposeViewController,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

原来是由于iOS 8测试版中的错误。我已经通过错误号17318153报告了

我正在为一个UITextField设置一个电子邮件地址。目的是让iOS看到一个电子邮件地址,如果用户点击它,则会显示一个 MFMailComposeViewController 的实例来发送一封电子邮件(它所做的)。

I'm setting an email address to a UITextField. The intent is for iOS to see its an email address and, if the user taps it, display an instance of MFMailComposeViewController to send an email (which it does).

但是,如果用户然后点按取消,则不会关闭 MFMailComposeViewController 。我试图将我的viewController设置为一个 MFMailComposeViewControllerDelegate 并覆盖 mailComposeController:didFinishWithResult:error:但它没有被调用。看来,当URL被轻击时显示的MFMailComposeViewController的代理未设置为self。

However, if the user then taps cancel, the MFMailComposeViewController is not being dismissed. I tried setting my viewController as a MFMailComposeViewControllerDelegate and overriding mailComposeController: didFinishWithResult: error: but it's not being called. Seemingly, the delegate for the MFMailComposeViewController that is displayed when the url is tapped is not set to self.

如何在 MFMailComposeViewController 实际上会关闭显示的视图控制器?

How can I make the cancel button in the MFMailComposeViewController actually dismiss the view controller that is displayed?

我的.h:

#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>

@interface AboutUsViewController : UIViewController<MFMailComposeViewControllerDelegate>{

    IBOutlet UIImageView *imageView;
    IBOutlet UITextView *companyName;
    IBOutlet UITextView *phoneNumber;
    IBOutlet UITextView *emailAddress;
    IBOutlet UITextView *aboutUsField;

}
@end

In .m: p>

In .m:

- (void)viewDidLoad {
        [super viewDidLoad];
        // Do any additional setup after loading the view.
        emailAddress.text=@"support@email.com";
}



- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
    switch (result)
    {
        case MFMailComposeResultCancelled:
            NSLog(@"Mail cancelled");
            break;
        case MFMailComposeResultSaved:
            NSLog(@"Mail saved");
            break;
        case MFMailComposeResultSent:
            NSLog(@"Mail sent");
            break;
        case MFMailComposeResultFailed:
            NSLog(@"Mail sent failure: %@", [error localizedDescription]);
            break;
        default:
            break;
    }

    // Close the Mail Interface
    [self dismissViewControllerAnimated:YES completion:NULL];
}


推荐答案

这是一个已知的iOS8测试版1个问题确保与Apple打开错误报告,并在此发布错误报告号码,以便人们可以复制。

This is a known iOS8 beta 1 issue. Make sure to open a bug report with Apple and post the bug report number here so people can duplicate.

这篇关于通过点击UITextVIew(iOS 8 beta bug)中的邮件链接显示MFMailComposeViewController,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆