0

我是 xcode 的新手,想知道如何在应用程序中发送电子邮件!我的代码在下面,但我不断收到“self presentModalViewController”行的错误。我的代码完全错误吗?还是我只是忘记声明选择器,如何声明选择器?有人请帮助我

     MFMailComposeViewController* controller          = [[MFMailComposeViewController alloc]         init];
controller.mailComposeDelegate = self;
[controller setSubject:@"My Subject"];
[controller setMessageBody:@"Hello there." isHTML:NO];
if (controller)[self presentModalViewController:controller animated:YES];


}
- (void)mailComposeController:(MFMailComposeViewController*)controller
  didFinishWithResult:(MFMailComposeResult)result
                error:(NSError*)error;
{
if (result == MFMailComposeResultSent) {
NSLog(@"It's away!");
}
[self dismissModalViewControllerAnimated:YES];
}
4

1 回答 1

0

请使用 [self presentViewController:controller animated:YES] 展示您的邮件编写器;

于 2013-06-25T05:05:36.227 回答