gpt4 book ai didi

iphone - 尝试发送电子邮件,收到 "use of undeclared unidentified MFMailComposeViewController"

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

我正在尝试在我的应用程序中发送电子邮件。我正在尝试使用 MFMailComposeViewController 对象,但收到一条错误消息,指出它是“未声明的标识符”

代码:

-(IBAction) aContact: (id) sender;
{


if([MFMailComposeViewController canSendMail]){

MFMailComposeViewController *mailCtrl = [[[MFMailComposeViewController alloc] init] autorelease];
[mailCtrl setSubject:@"Your TellaFortune Card Reading"];
// [mailCtrl setToRecipients:[NSArray arrayWithObject:@"drblyer@cameosurgery.com"]];
mailCtrl.mailComposeDelegate = self;

NSString *send;
send=[ NSString stringWithFormat: @"%@ %@",content,@"\n \n By www.TellaFortune.com"];
[mailCtrl setMessageBody: send isHTML: false];

[self presentModalViewController:mailCtrl animated:NO];
// [mailCtrl release];

}
else
{
UIAlertView *alert=[[ UIAlertView alloc]
initWithTitle:@"Cannot send email"
message: @"Please check internet connection and email set up"
delegate: self
cancelButtonTitle:@"Ok"
otherButtonTitles: nil];

[alert show];
}

}

最佳答案

将框架“MessageUI.framework”导入到您的项目中,并在 .h 文件中添加

#import <MessageUI/MessageUI.h>

关于iphone - 尝试发送电子邮件,收到 "use of undeclared unidentified MFMailComposeViewController",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22029842/

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