0
我是xcode新手,想知道如何在應用程序中發送電子郵件!我的代碼在下面,但我一直收到「自我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];
}
確切的錯誤你會得到幫助。 – davis
[presentsViewController:animated is not working]可能重複(http://stackoverflow.com/questions/12380412/presentingviewcontrolleranimated-isnt-working) – rmaddy
presentModalViewController已棄用。你應該停止使用它。 – borrrden