ios - how can i cause a MFMailComposeResultFailed error -


i want test behaviour made when email sending failed, can't mfmailcomposeresultfailed error. when there no internet connection, still "sends" email. how can done?

this not possible, hence kind of "errors" not delivered delegate. make sense, because "mail" takes care of sending or queuing mails.

from docs (mfmailcomposeviewcontroller)

using interface not guarantee immediate delivery of corresponding email message. user may cancel creation of message, , if user choose send message, message queued in mail application outbox. allows generate emails in situations user not have network access, such in airplane mode. interface not provide way verify whether emails sent.

you check internet connection before displaying mfmailcomposeviewcontroller. technical possible not recommended. mail automatically send mail if device connected internet again.

but have to check if device configured send mail:

if ([mfmailcomposeviewcontroller cansendmail]){  //show mfmailcomposeviewcontroller }else{  //show alertview } 

before using class, must check see if current device configured send email @ using cansendmail method. if user’s device not set delivery of email, can notify user or disable email dispatch features in application. should not attempt use interface if cansendmail method returns no.

https://developer.apple.com/library/ios/documentation/messageui/reference/mfmailcomposeviewcontroller_class/#//apple_ref/c/tdef/mfmailcomposeresult


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -