iOS Crash Pushing Mail Compose View Controller

时间:2017-04-20 02:45:51

标签: ios objective-c uinavigationcontroller mfmailcomposeviewcontroller

我最近遇到过问题。这曾经工作得很好,但最近,也许早在iOS 10.0,这只会导致应用程序崩溃,并出现以下错误:

  

由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'不支持推送导航控制器'

需要改变什么?

-(void) emailIt {
    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;

    [picker setSubject:@"To Fritch Church of Christ"];


    // Set up recipients
    NSArray *toRecipients = [NSArray arrayWithObject:@"tbrass84@yahoo.com"];

    [picker setToRecipients:toRecipients];

    // Fill out the email body text
    NSString *emailBody = @"Sent from the Fritch Church of Christ iOS App";
    [picker setMessageBody:emailBody isHTML:NO];

    [self.navigationController pushViewController:picker animated:YES];
    [picker release];

}

0 个答案:

没有答案