MFMailComposeVIEwController *picker = [[MFMailComposeVIEwController alloc] init];
但是选择器是nil而且应用程序崩溃并且因为未捕获的异常’NSinvalidargumentexception’而终止应用程序,原因:’应用程序尝试在目标上显示nil模态视图控制器.它在模拟器中工作正常,但在Device中崩溃.
如何在IOS 7中使用MFMailComposerVIEwController.
在您的Objective-C案例中:
MFMailComposeVIEwController *myMailCompose = [[MFMailComposeVIEwController alloc] init];if ([MFMailComposeVIEwController canSendMail]) { myMailCompose.mailComposeDelegate = self; [myMailCompose setSubject:@"Subject"]; [myMailCompose setMessageBody:@"message" isHTML:NO]; [self presentVIEwController:myMailCompose animated:YES completion:nil];} else { // unable to send mail,notify your users somehow}
斯威夫特3:
let myMailCompose = MFMailComposeVIEwController()if MFMailComposeVIEwController.canSendMail() { myMailCompose.mailComposeDelegate = self myMailCompose.setSubject("Subject") myMailCompose.setMessageBody("message",isHTML: false) self.present(myMailCompose,animated: true,completion: nil)} else { // unable to send mail,notify your users somehow}总结
以上是内存溢出为你收集整理的objective-c – 应用程序在IOS7中的MFMailComposeViewController对象上崩溃全部内容,希望文章能够帮你解决objective-c – 应用程序在IOS7中的MFMailComposeViewController对象上崩溃所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)