iPad Mini在modal segue上崩溃



我正在开发一款应用程序,它可以在所有部署目标模拟器(5.0-6.1)、iPhone 3GS、4、4S和第2代iPad上运行。我今天有机会尝试在iPad Mini上运行它。我在任何地方都能工作,除非我试图切换到MFMailComposeViewController对象来发送电子邮件,这会导致它崩溃并出现异常。

我直接使用MailComposer示例项目中的代码,但当它调用presentModalViewController:animated:时,它总是崩溃。所以我尝试presentViewController:animated:complete:,因为其他方法已被弃用,但它仍然不起作用。

我链接到MessageUI.framework导入的类:

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

委托已设置。这是代码:

-(void)displayComposerSheet
{
    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;
    [picker setSubject:@"Contact Email"];
    // Set up recipient
    NSArray *toRecipients = [NSArray arrayWithObject:@"info@foo.bar"];
    [picker setToRecipients:toRecipients];
    //  [self presentModalViewController:picker animated:YES];
    [self presentViewController:picker animated:YES completion:NULL];
}

iPad Mini可能存在导致这种情况的错误吗?我没有其他新设备可以尝试,所以我不确定是Mini问题还是更大的问题。如果有任何帮助,我将不胜感激,因为我已经准备好向苹果提交,但我肯定不想在出现崩溃错误的情况下这样做。

很可能是没有设置邮件帐户,或者由于其他原因无法发送电子邮件。

请务必首先调用MFMailComposeViewController的+ (BOOL)canSendMail函数。

尝试使用包装MFMailComposeViewController代码

if ( [MFMailCompseViewController canSendMail])

我猜设备上没有邮件设置。

最新更新