mfmailcomposeviewcontroller

Email CSV file with MFMailComposer

China☆狼群 提交于 2019-11-30 19:32:54
问题 I would like to create a file using a NSString (already made) with a .csv extension then email it using the UIMessage framework. So can someone show me the code to create a file (with a .csv extensions and with the contents of a NSString) then how to attach it to a MFMailComposeViewController. 回答1: This is how you attach a CSV file to a MFMailComposeViewController: MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init]; mailer.mailComposeDelegate = self; [mailer

MFMailComposeViewController not dismissing

我与影子孤独终老i 提交于 2019-11-30 19:22:22
I have the following code that gets called in didSelectRowAtIndexPath. The issue is, when I click the cancel button, it prompts for save draft or discard. But when I click either, the view does not dismiss. I've used the same code in a pre iOS 5 app and it dismissed fine. Any ideas? I have the MFMailComposeViewController delegate protocol in the interface. if (indexPath.row == 0) { if([MFMailComposeViewController canSendMail]) { MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self; [picker setSubject:@"Support"]; NSArray

MFMailComposeViewController Keyboard Issue

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 19:05:39
How do i dismiss the keyboard without pressing the Send or Cancel button in MFMailComposeViewController?! Thanks for any help. Can you try this. UIWindow* keyWindow = [[UIApplication sharedApplication] keyWindow]; UIView* firstResponder = [keyWindow performSelector:@selector(firstResponder)]; [firstResponder resignFirstResponder]; hope this helps.... I experienced a similar problem: For some reason iOS does not dismiss the Keyboard of a MFMailComposeViewController when the application enters background (the dismiss happens when the application becomes active again). However iOS dismisses the

how to dismiss mail view controller after tapping send or cancel button

…衆ロ難τιáo~ 提交于 2019-11-30 18:48:53
while sending mail, after tapping send or cancel button view controller stays there and app stalls. //swift 2.2 ; xcode 7.3.1 ; if( MFMailComposeViewController.canSendMail() ) { print("Can send email.") } var subjectText = "Verification" var toReceipients = ["notorious.roman@gmail.com"] // var msgBody = "Verified" var mc:MFMailComposeViewController = MFMailComposeViewController() mc.mailComposeDelegate = self mc.setSubject(subjectText) mc.setMessageBody("Verified", isHTML: false) mc.setToRecipients(toReceipients) self.presentViewController(mc, animated: true, completion: nil) } func

Change navigation button color in MFMailComposerViewController on iOS 7

陌路散爱 提交于 2019-11-30 14:43:00
问题 I'm trying to change the text color for navigation buttons in a MFMailComposerViewController but it doesn't work like on iOS 6. In iOS 6 it worked with UIAppearance like this: // Navigation button UIBarButtonItem *barButton = [UIBarButtonItem appearance]; NSDictionary *barButtonTitleTextAttributes = @{UITextAttributeTextColor: [UIColor redColor]}; NSDictionary *disabledBarButtonTitleTextAttributes = @{UITextAttributeTextColor: [UIColor grayColor]}; [barButton setTitleTextAttributes

iOS6: MFMailComposeViewController slow to load and flashes black screen; MailCompositionS begins hogging memory

早过忘川 提交于 2019-11-30 11:19:05
On iOS 6, after sending a few email messages (by using MFMailComposeViewController), the email screens become very slow to open- at first opening with none of the fields populated (no Subject, no body, etc.) for a few seconds, and eventually (after sending about 8 messages), a black screen is displayed to the user for a few seconds before the email view controller is properly displayed. The log spits out the following line before each black screen is displayed: [MFMailComposeRemoteViewController: ....] timed out waiting for fence barrier from com.apple.MailCompositionService Also, using

MFMessageComposeViewController alloc returns nil

此生再无相见时 提交于 2019-11-30 11:10:30
In my application, MFMailComposeViewController works fine but creating a new instance of MFMessageComposeViewController fails. Here is the code for both: -( IBAction)sendSMS: (id)sender { MFMessageComposeViewController *picker = [[[MFMessageComposeViewController alloc] init] autorelease]; picker.messageComposeDelegate = self; NSArray *toRecipients = [NSArray arrayWithObject: cell.currentTitle ]; picker.recipients = toRecipients; [self presentModalViewController:picker animated:YES]; } -( IBAction)sendEmail: (id)sender { MFMailComposeViewController *picker = [[[MFMailComposeViewController alloc

Change navigation button color in MFMailComposerViewController on iOS 7

浪子不回头ぞ 提交于 2019-11-30 11:06:31
I'm trying to change the text color for navigation buttons in a MFMailComposerViewController but it doesn't work like on iOS 6. In iOS 6 it worked with UIAppearance like this: // Navigation button UIBarButtonItem *barButton = [UIBarButtonItem appearance]; NSDictionary *barButtonTitleTextAttributes = @{UITextAttributeTextColor: [UIColor redColor]}; NSDictionary *disabledBarButtonTitleTextAttributes = @{UITextAttributeTextColor: [UIColor grayColor]}; [barButton setTitleTextAttributes:barButtonTitleTextAttributes forState:UIControlStateNormal]; [barButton setTitleTextAttributes

How to prevent crash on Cancel of MFMailComposeViewController?

最后都变了- 提交于 2019-11-30 09:54:45
Somewhere: if([MFMailComposeViewController canSendMail]) { MFMailComposeViewController *email_vc = [[MFMailComposeViewController alloc] init]; email_vc.mailComposeDelegate = self; [email_vc setSubject:subject]; [email_vc setMessageBody:message isHTML:FALSE]; [email_vc setToRecipients:recipients]; [self presentModalViewController:email_vc animated:FALSE]; [[UIApplication sharedApplication] setStatusBarHidden:TRUE]; [email_vc release]; } else ... Somewhere else: - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*

MFMailComposeViewController not dismissing

百般思念 提交于 2019-11-30 04:14:10
问题 I have the following code that gets called in didSelectRowAtIndexPath. The issue is, when I click the cancel button, it prompts for save draft or discard. But when I click either, the view does not dismiss. I've used the same code in a pre iOS 5 app and it dismissed fine. Any ideas? I have the MFMailComposeViewController delegate protocol in the interface. if (indexPath.row == 0) { if([MFMailComposeViewController canSendMail]) { MFMailComposeViewController *picker = [