mfmailcomposeviewcontroller错误'MailCompositionService意外退出'仅在ios 9模拟器上

时间:2015-10-05 09:06:45

标签: objective-c ios9

最近我升级到Xcode 7.0.1并在iOS 9 Simulator上运行,我开始面临错误'MailcompositionService意外退出'

我的电子邮件按钮单击代码:

isNull

Delegate Method也将错误视为nil:

if ([MFMailComposeViewController canSendMail])
{
    MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
    composer.mailComposeDelegate = self;

    [composer setToRecipients:[NSArray arrayWithObjects:@"support@badgermapping.com", nil]];

    NSDictionary* infoDict = [[NSBundle mainBundle] infoDictionary];
    NSString* version = [infoDict objectForKey:@"CFBundleShortVersionString"];
    NSString *ver = [[UIDevice currentDevice] systemVersion];

    [composer setMessageBody:[NSString stringWithFormat:@"\n\n\n\n\n\n App Version %@ \n iOS Version %@", version, ver] isHTML:NO];

    int count = 1;
    for (NSString *fullPath in [DeviceLoger getLogFilesPath])
    {
        NSData *fileData = [NSData dataWithContentsOfFile:fullPath];
        [composer addAttachmentData:fileData mimeType:@"text/plain" fileName:[NSString stringWithFormat:@"Log_File_%d",count]];
        count++;
    }


    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    {
        composer.modalPresentationStyle = UIModalPresentationFormSheet;
        [ROOT_VIEW_CONTROLLER presentViewController:composer animated:YES completion:NULL];
    }
    else
        [self presentViewController:composer animated:YES completion:nil];
}
else
    [Utility showDialog_OK:nil withMessage:NO_EMAIL_SETUP andButton:@"OK"];

任何想法?

0 个答案:

没有答案