views:

30

answers:

1

After a user tries to send some "in app" email from my iPhone app... I'd like to inform them of what happened. I put some code like this in my "didFinishWithResult" method:

if(result == MFMailComposeResultSent     ) NSLog(@"Email sent");   
if(result == MFMailComposeResultCancelled) NSLog(@"Email cancelled");
if(result == MFMailComposeResultFailed   ) NSLog(@"Can't send email.\nError # %d", result);
if(result == MFMailComposeResultSaved    ) NSLog(@"Email saved");

It works in all cases EXCEPT if the device is in the "airplane mode".

Then I get both "email sent" and "can't send now, queued for later sending" messages.

Is there a way for me to detect that? Shouldn't there be a MFMailComposeQueuedForLater result???

A: 

Its not possible for 'result' to have two distinct values, which is what your code fragment suggests is happening.

You haven't shown enough code to debug this, but at a guess what you actually have is not a set of if's and more like the case statement shown here:

http://books.google.com.au/books?id=FucBYCoIuWAC&pg=PA396&lpg=PA396&dq=MFMailComposeResultSent&source=bl&ots=z6UhJWpeTB&sig=zT5omjvETWzdMBm0OeSb5Cbic_k&hl=en&ei=38yXTN3mFcODcOOStd8J&sa=X&oi=book_result&ct=result&resnum=1&ved=0CBYQ6AEwAA#v=onepage&q=MFMailComposeResultSent&f=false

and you have omitted a break statement.

Jeff Laing