我試圖在我的應用程序中發送電子郵件。我試圖使用MFMailComposeViewController對象,但得到一個錯誤消息說其是「未聲明的標識符」試圖發送電子郵件,「使用未聲明的未識別的MFMailComposeViewController」
代碼:
-(IBAction) aContact: (id) sender;
{
if([MFMailComposeViewController canSendMail]){
MFMailComposeViewController *mailCtrl = [[[MFMailComposeViewController alloc] init] autorelease];
[mailCtrl setSubject:@"Your TellaFortune Card Reading"];
// [mailCtrl setToRecipients:[NSArray arrayWithObject:@"[email protected]"]];
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];
}
}
Thjank你,它的工作原理!!!! –