0
所以我知道我將不得不使用MFMailComposeResultSent。 (至少我認爲這就是我應該使用的)這是我有的代碼,它發送電子郵件和一切正常,但郵件作曲者保持。使MFMailComposeViewController在發送時消失
編輯:這裏是我的代碼
if ([condition isEqual: @"Excellent"] && [MFMailComposeViewController canSendMail]) {
NSString *emailBody = [NSString stringWithFormat:@"Product:%@ Make:%@ Year Manufactured:%@ Description:%@ Condition:Excellent Email:%@",inputProduct,inputMake,inputYear,inputDescript, inputEmail];
NSArray *recipient = [NSArray arrayWithObject:@"[email protected]"];
MFMailComposeViewController *SuperLovedEmail = [[MFMailComposeViewController alloc]init];
[SuperLovedEmail setTitle:emailTitle];
[SuperLovedEmail setToRecipients:recipient];
[SuperLovedEmail setMessageBody:emailBody isHTML:NO];
[SuperLovedEmail setUserActivity:false];
[self presentViewController:SuperLovedEmail animated:YES completion:nil];
}
else {
UIAlertController *emailAlert = [UIAlertController alertControllerWithTitle:@"Oh No!" message:@"Your Phone is not able to send an email currently or you have not chosen a condition. Please make sure you have chosen a condition and that you are signed in through Mail" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *emailAlertAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * emailAlertAction) {}];
[emailAlert addAction:emailAlertAction];
[self presentViewController:emailAlert animated:YES completion:nil];
}