Iphone 需要关于xcode中邮件生成器的帮助吗
我在上有警告,下面有错误消息。请帮忙Iphone 需要关于xcode中邮件生成器的帮助吗,iphone,xcode,email,Iphone,Xcode,Email,我在上有警告,下面有错误消息。请帮忙 从不兼容的类型“MyViewController”分配给“id” 和 类“MyViewController”未实现“MFMailComposeViewController”协议 代码是 -(void)displayComposerSheet { MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; //below bold code is w
从不兼容的类型“MyViewController”分配给“id”
和
类“MyViewController”未实现“MFMailComposeViewController”协议
代码是
-(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];
}
问题在于错误显示:您的类
MyViewController
不符合MFMailComposeViewControllerDelegate
协议。您的接口线应如下所示:
@interface MyViewController : UIViewController <MFMailComposeViewControllerDelegate>
@接口MyViewController:UIViewController
当然,您应该确保在类中实现mailComposeController:didFinishWithResult:error: