ios - 无法关闭通过单击 UITextVIew 中的邮件链接显示的 MFMailComposeViewController(iOS 8 测试版错误)

标签 ios objective-c email ios8

原来这是由于 iOS 8 beta 中的错误。我已通过错误号 17318153 报告了它

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

但是,如果用户随后点击取消,则不会关闭 MFMailComposeViewController。我尝试将我的 viewController 设置为 MFMailComposeViewControllerDelegate 并覆盖 mailComposeController: didFinishWithResult: error: 但它没有被调用。看起来,点击 url 时显示的 MFMailComposeViewController 的委托(delegate)未设置为 self。

如何让 MFMailComposeViewController 中的取消按钮真正关闭显示的 View Controller ?

我的.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

在 .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 beta 1 问题。确保打开 Apple 的错误报告并在此处发布错误报告编号,以便人们可以复制。

关于ios - 无法关闭通过单击 UITextVIew 中的邮件链接显示的 MFMailComposeViewController(iOS 8 测试版错误),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24218708/

相关文章:

iphone - iOS - 有清理 HTML 代码的好方法吗?

Python smtplib 和 smtputf8 修复的国际化错误

laravel - 发送没有主题的 Laravel Mailable

android - C++识别运行平台(Android、iOS等)

ios - Sprite Kit - 更改 SKShapeNode 的 anchor 不会更改 SKPhysicalBody 位置

ios - 为什么我的 MKCoordinateRegion 为零?

objective-c - 使 NSLevelIndicator 绘制圆角边缘

ios - UITableView 以编程方式在 UIScrollView 内部不调用委托(delegate)方法

objective-c - NSScanner 无法识别 scanUpToString 上的选择器

email - 正在使用我的域发送垃圾邮件,我该怎么办?