电子邮件控制器 - 如何实施?

时间:2011-07-14 16:39:14

标签: iphone objective-c cocoa-touch email

我正在尝试从我的应用中调用电子邮件程序。到目前为止我做了什么:

#import <MessageUI/MessageUI.h>

并添加了代表:

@interface MyViewController : UIViewController <MFMailComposeViewControllerDelegate>
然后我认为我会勇敢地把它放到我的代码中:

- (void)sendEmail {


    MFMailComposeViewController *mailComposer;

    mailComposer=[[MFMailComposeViewController alloc] init];
    mailComposer.mailComposeDelegate=self;
    [self presentModalViewController:mailComposer animated:YES];

    [mailComposer release];

}

但是,我只收到一条我不明白的错误信息。有人可以帮我解释一下吗?它对我没有任何意义,也没有指向一行代码,所以我不明白在调试时从哪里开始:

enter image description here

2 个答案:

答案 0 :(得分:2)

您需要#import .m文件中的框架

#import <MessageUI/MessageUI.h>
#import <MessageUI/MFMailComposeViewController.h>

答案 1 :(得分:1)

我认为你没有在你的项目MessageUI框架中添加框架。

相关问题