Bug 11702 - MFMailcomposecontroller example doesnt handle being canceled
Summary: MFMailcomposecontroller example doesnt handle being canceled
Alias: None
Product: Documentation
Classification: Xamarin
Component: MonoTouch ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: CraigD
Depends on:
Reported: 2013-04-10 08:51 UTC by daniel.c.treidene
Modified: 2016-04-10 23:58 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description daniel.c.treidene 2013-04-10 08:51:05 UTC
given the SendMail example project from the site as starting point. 

run it in ios simulator (I used 6.1) iphone.

*press send mail mail button
*press cancel to dismiss mail sender.
*press send mail mail button

in this state both cancel and send button do nothing.
Comment 1 Larry O'Brien 2016-04-08 00:42:06 UTC
I think this is talking about the recipe https://developer.xamarin.com/recipes/ios/shared_resources/email/send_an_email/ and it's basically saying that the recipe is not a complete solution because it doesn't show handlers for those buttons. 

(There's no sample code in the API docs.)
Comment 2 CraigD 2016-04-10 23:58:12 UTC
The sample is complete - the `Finished` handler is called in both places and the `Result` is queried to determine which button/action the user took. The `DismissViewController (true, null)` method is what closes the view controller in each case.

I'm unsure what the issue was with iOS 6.1, although I'd stress (as the recipe page does) to test on a physical device and not rely on the simulator for this function.

Having said that, I have updated the code after some testing with iOS 9. Re-using the MFMailComposeViewController seemed to create problems which were avoided by creating a new instance each time. I am able to both Cancel and Send successfully on an iOS 9 device with the updated code.