mfmailcomposeviewcontroller

MFMailComposeViewController - iPad

核能气质少年 提交于 2019-11-28 23:46:22
问题 I've setup a MFMailComposeViewController and it works just fine on the iPhone, but on the iPad it crashes, saying: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target... So why would this create a nil modal view? MFMailComposeViewController *message = [[MFMailComposeViewController alloc] init]; [message setMessageBody:@"My message here" isHTML:NO]; [message setToRecipients:[NSArray

Change title of MFMailComposeViewController

半世苍凉 提交于 2019-11-28 23:28:34
I'm using MFMailComposeViewController for in-app email in my app, but I'm not able to change the title. As default it's showing the subject in the title, but I would like to set the title to be something else. How can I do that? I've tried: controller.title = @"Feedback"; but it didn't work. Here's my code: - (IBAction)email { NSArray *array = [[NSArray alloc] initWithObjects:@"myemail@gmail.com", nil]; MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init]; [[controller navigationBar] setTintColor:[UIColor colorWithRed:0.36 green:0.09 blue:0.39 alpha:1.00]];

Change title color of navigation bar in MFMailComposeViewController in iOS 12 not working

我怕爱的太早我们不能终老 提交于 2019-11-28 20:58:08
问题 How can I change the title color of UINavigationBar in MFMailComposeViewController in iOS 12 ? This is what I am doing: import MessageUI extension MFMailComposeViewController { open override func viewDidLoad() { super.viewDidLoad() navigationBar.isTranslucent = false navigationBar.isOpaque = false navigationBar.barTintColor = .white navigationBar.tintColor = .white navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white] } } In iOS 10 works: In iOS 11 works:

MFMailComposeViewController without Mail app installed?

余生长醉 提交于 2019-11-28 12:44:41
Now that apps like Apple's "Mail" app can be deleted in iOS 10, what will happen when a developer attempts to initialize and present MFMailComposeViewController and the default Mail app is not installed and configured on the device? If the app crashes, what is the best way to check for this case? On iOS 12 and above, canSendMail() will return true even if the Mail app is not installed. The MFMailComposeViewController will be presented, but the user will be unable to send mail. On iOS versions below 12: It looks like MFMailComposeViewController.canSendMail() will return false, and

How to customize MFMailComposeViewController so that i can make the “to” field as non-editable?

為{幸葍}努か 提交于 2019-11-28 12:33:29
I am using MFMailComposeViewController for sending feedback in my app. It works fine. But the problem here is, the user can edit/delete the "to" address. I want to make it as a non-editable one. May be, the user can add some mail addresses in "to" field. But he/she should not delete the feedback address (Here, it is "support@xxxx.com"). Here is my code... MFMailComposeViewController *composeWindow = [[MFMailComposeViewController alloc] init]; composeWindow.mailComposeDelegate = self; NSString *str = @"Subject of the feedback"; [composeWindow setSubject:[str stringByAppendingString:[[UIDevice

MFMailComposeViewController in other languages?

主宰稳场 提交于 2019-11-28 11:34:16
Does MFMailComposeViewController come only in English!? I am toying around with the idea of using MFMailComposeViewController to handle sending email from my app but I need it to conform to the language environments of devices set to languages other than english. Is it possible to set MFMailComposeViewController to other languages? Even if I set my device's language to, say, japanese, the MFMailComposeViewController's To:, From:, Subject:, portions remain in english. How does one change the language of MFMailComposeViewController? MFMailComposeViewController will display in the language the

MFMailComposeViewController behaves differently in iOS 13 simulator and device

懵懂的女人 提交于 2019-11-28 10:00:16
问题 I'm trying to display MFMailComposeViewController in an app. if MFMailComposeViewController.canSendMail() { let mailComposeViewController = MFMailComposeViewController() mailComposeViewController.navigationBar.tintColor = .white mailComposeViewController.mailComposeDelegate = self mailComposeViewController.setToRecipients(["support@gmail.com"]) mailComposeViewController.setSubject("Feedback") present(mailComposeViewController, animated: true) } else { print("This device is not configured to

ios: Application tried to present a nil modal view controller on target

懵懂的女人 提交于 2019-11-28 08:05:58
I am developing an application,the requirement is to open email composer on a button click of UIAlertView. message which is in message body of email is copied from UITextView. i am using following code snipt: -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ if (buttonIndex == 0) { // opening message composer } else { MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self; [picker setSubject:@"Test mail"]; [picker setMessageBody:messageBody.text isHTML:YES]; [self presentViewController:picker

MFMailComposeViewController : how do I embed a clickable URL link into the email message body

时光毁灭记忆、已成空白 提交于 2019-11-28 07:38:48
I want my app using the MFMailComposeViewController to send an email such that the recipient can click on the embedded url to open the corresponding web site. MFMailComposeViewController does not appear to support this explicitly. Any ideas? :) Yes, you can do this: MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init]; composer.mailComposeDelegate = self; [composer setSubject:subject]; [composer setMessageBody:message isHTML:YES]; where message is just an NSString with HTML content. Inside you can add all the HTML you want. I deleted my previous answer as it was

Attaching an image to an email?

情到浓时终转凉″ 提交于 2019-11-28 06:19:49
问题 I want to to use MFMailComposeViewController to send an email, and I already have that set up, but I'm having trouble actually attaching an image, which is a screenshot, into the email. Here's the line of code. [composer addAttachmentData:image mimeType:image/png //png undeclared//fileName:@"GameOver Screenshot.png"]; //Incompatible Obj-C types 'struct UIImage *' expected 'struct NSData *' when passing argument 1 of .....// image is the name of my UIImage screenshot. I'm not sure what to