我正在使用Xcode创建一个客观的c应用程序
有没有办法从五个左右的文本字段中发送电子邮件,这样当用户点击发送按钮时,它会将他们输入的数据发送到文本字段到预定义的电子邮件地址。
我已尝试搜索已经提出的相关问题,但现在已弃用了许多使用的技术。
我试过了:
-(IBAction)email {
MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
[composer setMailComposeDelegate:self];
([MFMailComposeViewController canSendMail]); {
[composer setToRecipients:[NSArray arrayWithObjects:@"makingwavesswimschool@live.co.uk", nil]];
[composer setSubject:@"Enter Subject Here"];
[composer setMessageBody:@"Enter Message Here" isHTML:NO];
[composer setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self presentModalViewController:composer animated:YES];
}
}
-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
if (error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:[NSString stringWithFormat:@"Error %@", [error description]]
delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil, nil];
[alert show];
[self dismissModalViewControllerAnimated:YES];
}
else {
[self dismissModalViewControllerAnimated:YES];
}
}
然而,这会崩溃到现在并且忽略模态视图控制器被弃用。
有没有办法修改它来处理表单?
由于