MFMailComposeViewController仅在iOS 9中引发错误 [英] MFMailComposeViewController throws an error only in iOS 9
问题描述
我无法在没有在iOS 9模拟器中抛出致命错误的情况下打开MFMailComposeViewController。
I can't get MFMailComposeViewController to open without throwing a fatal error in iOS 9 Simulator.
相同的代码(Objective C)在iOS 8.x中完美运行更低但今天我安装了Xcode 7 beta 5,当我在iOS 9模拟器上运行应用程序时,我得到一个标题为MailCompositionService意外退出的对话框,当我查看错误报告时,我看到:
The same code (Objective C) works flawlessly in iOS 8.x and lower but today I installed Xcode 7 beta 5 and when I run the app on iOS 9 Simulator, I get a dialog box titled "MailCompositionService quit unexpectedly" and when I view the error report, I see:
应用程序特定信息:
***由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:' - [__ NSArrayI isEqualToString:]:无法识别的选择器发送到实例0x7fd314280b10'
Application Specific Information: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI isEqualToString:]: unrecognized selector sent to instance 0x7fd314280b10'
以NSException类型的未捕获异常终止
abort()调用
CoreSimulator 179 - 设备:iPhone 6 - 运行时:iOS 9.0( 13A4325c) - DeviceType:iPhone 6
terminating with uncaught exception of type NSException abort() called CoreSimulator 179 - Device: iPhone 6 - Runtime: iOS 9.0 (13A4325c) - DeviceType: iPhone 6
邮件撰写视图出现时发生错误。它会冻结几秒钟然后出现错误对话框。
The error happens when the mail composition view comes up. It freezes for a few seconds and then the error dialog box comes up.
打开邮件撰写视图的代码是:
The code that opens the mail composition view is:
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Comment title"];
[picker setMessageBody:@"Comment description" isHTML:NO];
[self.window.rootViewController presentModalViewController:picker animated:YES];
[picker release];
}
如果知道,在应用程序崩溃之前, mailComposeController:didFinishWithResult:error:
使用结果
= MFMailComposeResultCancelled
和错误
= nil
。
If it helps to know, before the app crashes, mailComposeController:didFinishWithResult:error:
is called with result
= MFMailComposeResultCancelled
and error
= nil
.
我很欣赏有关如何使用的提示找到此错误的原因。谢谢!
I'd appreciate tips on how to find the cause of this error. Thanks!
推荐答案
问题在于模拟器,在真实设备上邮件编辑器工作正常。
The issue is with simulator, on the real device mail composer is working correctly.
这篇关于MFMailComposeViewController仅在iOS 9中引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!