gpt4 book ai didi

iphone - 如何在iphone SDK中发送电子邮件?

转载 作者:行者123 更新时间:2023-12-03 18:37:51 25 4
gpt4 key购买 nike

如何在iphone SDK中发送电子邮件?任何从 iPhone 获取电子邮件地址的示例教程还有?

最佳答案

您应该使用隐藏在 MessageUI 框架中的 MFMailComposeViewController 类和 MFMailComposeViewControllerDelegate 协议(protocol)。

首先发送消息:

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

然后用户完成工作,并且您及时收到委托(delegate)回调:

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

关于iphone - 如何在iphone SDK中发送电子邮件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1513324/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com