I have warning on with error message below. Please help.
Assigning to 'id<MFMailComposeViewControllerDeelegate>' from incompatible type 'MyViewController'
and Class 'MyViewController' does not implement the 'MFMailComposeViewControllerDelegate' protocol
The code is
-(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];
}
The problem is as the error says: your class MyViewController
doesn't conform to the MFMailComposeViewControllerDelegate
protocol. Your interface line should look something like this:
@interface MyViewController : UIViewController <MFMailComposeViewControllerDelegate>
And, of course, you should be sure to implement mailComposeController:didFinishWithResult:error:
in your class.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.