MFMailComposeViewController – iPad

MFMailComposeViewController – iPad,第1张

概述我设置了一个MFMailComposeViewController,它的工作原理在iPhone上很好,但在iPad上崩溃,说: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view contr 我设置了一个MFMailComposeVIEwController,它的工作原理在iPhone上很好,但在iPad上崩溃,说:

*** Terminating app due to uncaught exception 'NSinvalidargumentexception',reason: 'Application trIEd to present a nil modal vIEw controller on target...

那么为什么会创建一个零模式视图?

MFMailComposeVIEwController *message = [[MFMailComposeVIEwController alloc] init];    [message setMessageBody:@"My message here"  isHTML:NO];    [message setToRecipIEnts:[NSArray arrayWithObject:@"my@domain.com"]];    [message setSubject:@"Request Info"];    message.mailComposeDelegate = self;    if (UI_USER_INTERFACE_IdioM() == UIUserInterfaceIdiomPad)        message.modalPresentationStyle = UIModalPresentationFormSheet;    [self presentModalVIEwController:message animated:YES];    [message release];

有任何想法吗?

解决方法 Loos像MFMailComposeVIEwController不是由于某种原因创建的,因此具有nil值。检查它是否为nil之前提出它(虽然这个解决方法没有回答这里出错了…)。

您还应该执行检查邮件编写者是否可以发送邮件,然后尝试创建和使用canSendMail方法(如果没有邮件帐户设置在设备上显示它将返回否):

if ([MFMailComposeVIEwController canSendMail]){    // Create and show composer } else{   // Show some error message here }
总结

以上是内存溢出为你收集整理的MFMailComposeViewController – iPad全部内容,希望文章能够帮你解决MFMailComposeViewController – iPad所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1087484.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存