实例方法presentModalViewController:未找到动画 [英] instance method presentModalViewController:animated not found

查看:101
本文介绍了实例方法presentModalViewController:未找到动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在app delegate中实现电子邮件编辑器。
我不知道为什么,但我收到警告

I am implementing email composer in app delegate. I am not sure why , but i am getting an warning


实例方法presentModalViewController:动画未找到

"instance method presentModalViewController:animated not found"

仅在appdelegate,而我在其他viewcontroller中使用相同的方法,它可以顺利运行。

only at the appdelegate,whereas, i am using the the same method in my other viewcontroller, which works smoothly.

  MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init]; 
  mail.mailComposeDelegate = self; 

  if([MFMailComposeViewController canSendMail]) 
  {
     //Setting up the Subject, recipients, and message body.

     [mail setToRecipients:[NSArray arrayWithObjects:@"abc@gmail.com",nil]];
     UIImage *pic = [UIImage imageNamed:@"page0.png"];
     NSData *exportData = UIImageJPEGRepresentation(pic ,1.0);
     [mail addAttachmentData:exportData mimeType:@"image/jpeg" fileName:@"Picture.jpeg"];

     [mail setSubject:@"dummy text"];
     [mail setMessageBody:@"Please tell us what your concerns are and we will try to fix them" isHTML:NO];
     //Present the mail view controller
     [self presentModalViewController:mail animated:YES]; 
     //release the mail [mail release];
  } 

[self presentModalViewController:mailer animated:YES]; 这是警告,应用程序在到达此处时会崩溃。

[self presentModalViewController:mailer animated:YES]; this is giving warning and app gets crashed,when reach here.

任何建议。

推荐答案

[self presentModalViewController:mail animated:YES];   

是UIViewControllers方法。请检查您是否已从UIViewController扩展您的课程

is UIViewControllers Method . Please check whether you have extended your class from UIViewController

@interface abc : UIViewController

这篇关于实例方法presentModalViewController:未找到动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆