在xcode中需要有关邮件编辑器的帮助

时间:2011-05-17 02:22:17

标签: iphone xcode email

我发出警告,上面有错误消息。请帮忙。

Assigning to 'id<MFMailComposeViewControllerDeelegate>' from incompatible type 'MyViewController'Class 'MyViewController' does not implement the 'MFMailComposeViewControllerDelegate' protocol

代码是

-(void)displayComposerSheet 

{

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];

//below bold code is warning 

    **picker.mailComposeDelegate = self;**

[picker setSubject:@"My first apps!"];


// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObjects: nil]; 


[picker setToRecipients:toRecipients];

[picker setMessageBody:TextView.text isHTML:NO];

[self presentModalViewController:picker animated:YES];

[picker release];

}

1 个答案:

答案 0 :(得分:1)

问题出在错误上:您的班级MyViewController不符合MFMailComposeViewControllerDelegate协议。您的界面行应如下所示:

@interface MyViewController : UIViewController <MFMailComposeViewControllerDelegate>

当然,您应该确保在班上实施mailComposeController:didFinishWithResult:error: