Thanks, Alex! That helps.

Nic, I don't seem to have run afoul of the bug, fortunately. :-)


--Chris


Nic Wise wrote
> If you are using MFMailComposeViewController, you may want to look at this
> 
> https://bugzilla.xamarin.com/show_bug.cgi?id=7443
> 
> Possibly a bug with 6.0.0 / 6.0.1 MT, if you use it in a VERY specific
> way when using UIAppearance in a VERY specific way :)
> 
> Odds are, you will not hit this, but if you do, it's there :)
> 
> On Thu, Sep 27, 2012 at 6:12 AM, Alex White <

> alexwhite68@

> > wrote:
>> Hi Chris,
>>
>> what works for me is the following two bits of code
>>
>>
>> pdfFileName = Path.Combine
>> (Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
>> "docs.pdf");
>> NSData data = NSData.FromFile (pdfFileName);
>> MFMailComposeViewController mail = new MFMailComposeViewController ();
>> mail.SetSubject ("docs");
>> mail.SetMessageBody ("", true);
>> mail.Finished += HandleMailFinished;
>> mail.AddAttachmentData (data, "text/x-pdf", "docs.pdf");
>> this.NavigationController.PresentModalViewController (mail, true);
>>
>>
>>
>> void HandleMailFinished (object sender, MFComposeResultEventArgs e)
>> {
>> if (e.Result == MFMailComposeResult.Sent) {
>> UIAlertView alert = new UIAlertView ("sdklsdksdlkskdsd", "Mail Sent",
>> null,
>> "Ok", null);
>> alert.Show ();
>> }  else if (e.Result == MFMailComposeResult.Cancelled) {
>> }  else if (e.Result == MFMailComposeResult.Saved) {
>> }
>> e.Controller.DismissModalViewControllerAnimated (true);
>> }
>>
>> you can bung some code in the cancelled result if you need to.
>>
>> ATB
>>
>> Alex
>>
>>
>> On 26 Sep 2012, at 21:28, Chris_M <

> kungfuchris99@

> > wrote:
>>
>>
>> My app has a UITabBarController. One of the tabs is to enable a user to
>> send
>> an email to my clients. I created a UIViewController for that tab bar
>> item,
>> and in its ViewDidLoad I have code that uses Reachability to determine if
>> an
>> internet connection is there, and if
>> MFMailComposeViewController.CanSendMail, I invoke a MailComposeDelegate
>> so
>> the user can compose and send an email. This all works just fine. But I
>> have
>> two problems.
>>
>> First, if I cancel the email composition, and the compose email modal
>> view
>> goes away, the view is blank, and navigating away from this screen and
>> back
>> to it doesn't "reset" anything (not that I expected it to). So I need to
>> figure out how to "rest" that mail functionality in the
>> MFMailComposeResult.Cancelled block of code (right now it just disposes
>> of
>> the modal view controller in an animated fashion).
>>
>> Second, when I do send an email, I get a "Mail Alert: Mail Sent" alert as
>> expected, but it stays on the screen and effectively locks the app until
>> I
>> force close it and launch it again. So obviously I'm missing a step in
>> there
>> somewhere. Presumably something I need to add to the
>> MFMailComposeResult.Sent block of code. Maybe I need to set how many
>> seconds
>> the "Mail Sent" alert stays on the screen, or something like that?
>>
>> I couldn't find code examples online to help with this, but maybe I'm not
>> looking for the right things. Anyway, any suggestions?
>>
>>
>> --Chris
> 
> MonoTouch mailing list

> [email protected]

> http://lists.ximian.com/mailman/listinfo/monotouch





--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Fun-with-MFMailComposeViewController-tp4657247p4657300.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to