gpt4 book ai didi

objective-c - 在 dismissModalViewController 中获取 SIGABRT 错误

转载 作者:行者123 更新时间:2023-11-28 23:01:54 24 4
gpt4 key购买 nike

我在取消 MFMailComposeViewController 时收到 SIGABRT 错误,正好在 dismissViewController 中,不起作用

我在 UINavigationController 中有一个 UIViewController

我的代码:

- (void)sendMail {
if ([MFMailComposeViewController canSendMail]) {
controller = [[MFMailComposeViewController alloc] init];
[[controller navigationBar] setTintColor:[UIColor getHexColorWithRGB:@"e2de09" alpha:1.0f]];
controller.mailComposeDelegate = self;
[controller setSubject:@"Subject"];

NSString *msg="xxxxx";
[controller setMessageBody:msg isHTML:YES];

[self presentModalViewController:controller animated:YES];

} else {
NSString * errorString = [NSString stringWithFormat:@"mail account not set."];

UIAlertView * errorAlert = [[UIAlertView alloc] initWithTitle:@"Error:" message:errorString delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[errorAlert show];
}
}

presentModalViewController:animated: 工作正常。

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
[self becomeFirstResponder];
[self dismissModalViewControllerAnimated:YES];
}

但是调用 [self dissmissModalViewControllerAnimatedLYES] 会导致 SIGABRT 错误。

最佳答案

我认为应该在 MFMailComposer 对象上调用“dismissModalViewControllerAnimated”,在您的例子中是“controller”。请注意,它实际上是一个 View Controller 。

关于objective-c - 在 dismissModalViewController 中获取 SIGABRT 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9857865/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com